Skip to content

Commit 3b267b1

Browse files
committed
[clang] Add zero-initialization for fixed point types
1 parent 4d8e849 commit 3b267b1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

clang/lib/AST/ExprConstant.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11427,6 +11427,10 @@ class FixedPointExprEvaluator
1142711427
return true;
1142811428
}
1142911429

11430+
bool ZeroInitialization(const Expr *E) {
11431+
return Success(0, E);
11432+
}
11433+
1143011434
//===--------------------------------------------------------------------===//
1143111435
// Visitor Methods
1143211436
//===--------------------------------------------------------------------===//
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// RUN: %clang_cc1 -ffixed-point %s -verify
2+
// expected-no-diagnostics
3+
4+
constexpr _Accum a[2] = {};
5+
static_assert(a[0] == 0 && a[0] != 1);

0 commit comments

Comments
 (0)