diff options
Diffstat (limited to 'clang/test')
| -rw-r--r-- | clang/test/CodeGenCXX/const-init-cxx11.cpp | 8 | ||||
| -rw-r--r-- | clang/test/SemaCXX/constant-expression-cxx11.cpp | 6 |
2 files changed, 14 insertions, 0 deletions
diff --git a/clang/test/CodeGenCXX/const-init-cxx11.cpp b/clang/test/CodeGenCXX/const-init-cxx11.cpp index fa56f598089..14a2f877170 100644 --- a/clang/test/CodeGenCXX/const-init-cxx11.cpp +++ b/clang/test/CodeGenCXX/const-init-cxx11.cpp @@ -94,6 +94,14 @@ namespace Array { // CHECK: @_ZN5Array1dE = constant {{.*}} { [2 x i32] [i32 1, i32 2], [3 x i32] [i32 3, i32 4, i32 5] } struct D { int n[2]; int m[3]; } extern constexpr d = { 1, 2, 3, 4, 5 }; + + struct E { + char c[4]; + char d[4]; + constexpr E() : c("foo"), d("x") {} + }; + // CHECK: @_ZN5Array1eE = global {{.*}} { [4 x i8] c"foo\00", [4 x i8] c"x\00\00\00" } + extern constexpr E e = E(); } namespace MemberPtr { diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp index f5cc1b31ca3..a048297bb5a 100644 --- a/clang/test/SemaCXX/constant-expression-cxx11.cpp +++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp @@ -408,6 +408,12 @@ struct U { } constexpr u = { { L"test" }, 0 }; static_assert(u.chars[2] == L's', ""); +struct V { + char c[4]; + constexpr V() : c("hi!") {} +}; +static_assert(V().c[1] == "i"[0], ""); + } namespace Array { |

