diff options
author | dim <dim@FreeBSD.org> | 2013-06-10 20:45:12 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-06-10 20:45:12 +0000 |
commit | ea266cad53e3d49771fa38103913d3ec7a166694 (patch) | |
tree | 8f7776b7310bebaf415ac5b69e46e9f928c37144 /test/PCH/cxx1y-default-initializer.cpp | |
parent | c72c57c9e9b69944e3e009cd5e209634839581d3 (diff) | |
download | FreeBSD-src-ea266cad53e3d49771fa38103913d3ec7a166694.zip FreeBSD-src-ea266cad53e3d49771fa38103913d3ec7a166694.tar.gz |
Vendor import of clang tags/RELEASE_33/final r183502 (effectively, 3.3
release):
http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_33/final@183502
Diffstat (limited to 'test/PCH/cxx1y-default-initializer.cpp')
-rw-r--r-- | test/PCH/cxx1y-default-initializer.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/test/PCH/cxx1y-default-initializer.cpp b/test/PCH/cxx1y-default-initializer.cpp new file mode 100644 index 0000000..5a68f27 --- /dev/null +++ b/test/PCH/cxx1y-default-initializer.cpp @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -pedantic -std=c++1y -emit-pch %s -o %t +// RUN: %clang_cc1 -pedantic -std=c++1y -include-pch %t -verify %s + +#ifndef HEADER_INCLUDED + +#define HEADER_INCLUDED + +struct A { + int x; + int y = 3; + int z = x + y; +}; +template<typename T> constexpr A make() { return A {}; } +template<typename T> constexpr A make(T t) { return A { t }; } + +struct B { + int z1, z2 = z1; + constexpr B(int k) : z1(k) {} +}; + +#else + +static_assert(A{}.z == 3, ""); +static_assert(A{1}.z == 4, ""); +static_assert(A{.y = 5}.z == 5, ""); // expected-warning {{C99}} +static_assert(A{3, .y = 1}.z == 4, ""); // expected-warning {{C99}} +static_assert(make<int>().z == 3, ""); +static_assert(make<int>(12).z == 15, ""); + +#endif |