Skip to content

Commit 8573eb1

Browse files
committed
Add a few more tests.
1 parent 39e6548 commit 8573eb1

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

clang/test/SemaCXX/builtin-is-constant-evaluated.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,15 @@ namespace narrowing {
156156
}
157157

158158
struct GH99680 {
159-
static const int x = 1/(1-__builtin_is_constant_evaluated()); // expected-error {{in-class initializer for static data member is not a constant expression}} \
159+
static const int x1 = 1/(1-__builtin_is_constant_evaluated()); // expected-error {{in-class initializer for static data member is not a constant expression}} \
160160
// expected-note {{division by zero}}
161+
static const int x2 = __builtin_is_constant_evaluated();
162+
static_assert(x2 == 1);
163+
static const float x3 = 1/(1-__builtin_is_constant_evaluated()); // expected-error {{in-class initializer for static data member of type 'const float' requires 'constexpr' specifier}} \
164+
// expected-note {{add 'constexpr'}} \
165+
// expected-error {{in-class initializer for static data member is not a constant expression}} \
166+
// expected-note {{division by zero}}
167+
static const float x4 = __builtin_is_constant_evaluated(); // expected-error {{in-class initializer for static data member of type 'const float' requires 'constexpr' specifier}} \
168+
// expected-note {{add 'constexpr'}}
169+
static_assert(fold(x4 == 1));
161170
};

0 commit comments

Comments
 (0)