summaryrefslogtreecommitdiffstats
path: root/test/SemaCXX/constant-expression-cxx11.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaCXX/constant-expression-cxx11.cpp')
-rw-r--r--test/SemaCXX/constant-expression-cxx11.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/test/SemaCXX/constant-expression-cxx11.cpp b/test/SemaCXX/constant-expression-cxx11.cpp
index 578a057104..03491f4a87 100644
--- a/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/test/SemaCXX/constant-expression-cxx11.cpp
@@ -2146,7 +2146,7 @@ namespace InheritedCtor {
struct B : A { int n; using A::A; }; // expected-note {{here}}
constexpr B b(0); // expected-error {{constant expression}} expected-note {{derived class}}
- struct C : A { using A::A; struct { union { int n, m = 0; }; union { int a = 0; }; int k = 0; }; struct {}; union {}; }; // expected-warning 4{{extension}}
+ struct C : A { using A::A; struct { union { int n, m = 0; }; union { int a = 0; }; int k = 0; }; struct {}; union {}; }; // expected-warning 6{{}}
constexpr C c(0);
struct D : A {
@@ -2220,3 +2220,11 @@ namespace PointerArithmeticOverflow {
constexpr int *q = (&n + 1) - (unsigned __int128)-1; // expected-error {{constant expression}} expected-note {{cannot refer to element -3402}}
constexpr int *r = &(&n + 1)[(unsigned __int128)-1]; // expected-error {{constant expression}} expected-note {{cannot refer to element 3402}}
}
+
+namespace PR40430 {
+ struct S {
+ char c[10] = "asdf";
+ constexpr char foo() const { return c[3]; }
+ };
+ static_assert(S().foo() == 'f', "");
+}