diff options
Diffstat (limited to 'clang/test')
-rw-r--r-- | clang/test/CodeGenCXX/const-init-cxx11.cpp | 7 | ||||
-rw-r--r-- | clang/test/SemaCXX/constant-expression-cxx11.cpp | 13 |
2 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/const-init-cxx11.cpp b/clang/test/CodeGenCXX/const-init-cxx11.cpp index 07385eedbae..d2504d78cd3 100644 --- a/clang/test/CodeGenCXX/const-init-cxx11.cpp +++ b/clang/test/CodeGenCXX/const-init-cxx11.cpp @@ -121,6 +121,13 @@ namespace Array { }; // CHECK: @_ZN5Array1eE = constant {{.*}} { [4 x i8] c"foo\00", [4 x i8] c"x\00\00\00" } extern constexpr E e = E(); + + // PR13290 + struct F { constexpr F() : n(4) {} int n; }; + // CHECK: @_ZN5Array2f1E = global {{.*}} zeroinitializer + F f1[1][1][0] = { }; + // CHECK: @_ZN5Array2f2E = global {{.* i32 4 .* i32 4 .* i32 4 .* i32 4 .* i32 4 .* i32 4 .* i32 4 .* i32 4}} + F f2[2][2][2] = { }; } namespace MemberPtr { diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp index 2cd66b6f626..f576dfa32f2 100644 --- a/clang/test/SemaCXX/constant-expression-cxx11.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp @@ -494,6 +494,19 @@ struct ArrayRVal { }; static_assert(ArrayRVal().elems[3].f() == 0, ""); +constexpr int selfref[2][2][2] = { + selfref[1][1][1] + 1, selfref[0][0][0] + 1, + selfref[1][0][1] + 1, selfref[0][1][0] + 1, + selfref[1][0][0] + 1, selfref[0][1][1] + 1 }; +static_assert(selfref[0][0][0] == 1, ""); +static_assert(selfref[0][0][1] == 2, ""); +static_assert(selfref[0][1][0] == 1, ""); +static_assert(selfref[0][1][1] == 2, ""); +static_assert(selfref[1][0][0] == 1, ""); +static_assert(selfref[1][0][1] == 3, ""); +static_assert(selfref[1][1][0] == 0, ""); +static_assert(selfref[1][1][1] == 0, ""); + } namespace DependentValues { |