diff options
author | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | 952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /test/Parser/cxx-member-initializers.cpp | |
parent | ea266cad53e3d49771fa38103913d3ec7a166694 (diff) | |
download | FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz |
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'test/Parser/cxx-member-initializers.cpp')
-rw-r--r-- | test/Parser/cxx-member-initializers.cpp | 72 |
1 files changed, 69 insertions, 3 deletions
diff --git a/test/Parser/cxx-member-initializers.cpp b/test/Parser/cxx-member-initializers.cpp index 5c39068..ff8c880 100644 --- a/test/Parser/cxx-member-initializers.cpp +++ b/test/Parser/cxx-member-initializers.cpp @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s struct x { x() : a(4) ; // expected-error {{expected '{'}} @@ -11,5 +11,71 @@ struct y { struct z { int a; - z() : a {} // expected-error {{expected '('}} -}; + z() : a {} +}; // expected-error {{expected '{'}} + +namespace PR16480 { + template<int n> struct X { + X(); + X(int); + }; + + struct A : X<0> { + A() : X<a<b>{0}.n>() {} + + template<int> struct a { + int n; + }; + + static const int b = 1; + }; + + struct B : X<0> { + B() : X<a<b>{0} {} + + static const int a = 0, b = 0; + }; + + template<int> struct a { + constexpr a(int) {} + constexpr operator int() const { return 0; } + }; + + struct C : X<0> { + C() : X<a<b>(0)>() {} + + static const int b = 0; + }; + + struct D : X<0> { + D() : X<a<b>(0) {} + + static const int a = 0, b = 0; + }; + + template<typename T> struct E : X<0> { + E(X<0>) : X<(0)>{} {} + E(X<1>) : X<int{}>{} {} + E(X<2>) : X<(0)>() {} + E(X<3>) : X<int{}>() {} + }; + + // FIXME: This should be valid in the union of C99 and C++11. + struct F : X<0> { + F() : X<A<T>().n + (T){}.n>{} {} // expected-error +{{}} + + struct T { int n; }; + template<typename> struct A { int n; }; + }; // expected-error +{{}} + + // FIXME: This is valid now, but may be made ill-formed by DR1607. + struct G : X<0> { + G() : X<0 && [](){return 0;}()>{} // expected-error +{{}} + }; // expected-error +{{}} + + struct Errs : X<0> { + Errs(X<0>) : decltype X<0>() {} // expected-error {{expected '(' after 'decltype'}} + Errs(X<1>) : what is this () {} // expected-error {{expected '(' or '{'}} + Errs(X<2>) : decltype(X<0> // expected-note {{to match this '('}} + }; // expected-error {{expected ')'}} +} |