From 952eddef9aff85b1e92626e89baaf7a360e2ac85 Mon Sep 17 00:00:00 2001 From: dim Date: Sun, 22 Dec 2013 00:07:40 +0000 Subject: Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3): https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841 --- test/Parser/cxx-member-initializers.cpp | 72 +++++++++++++++++++++++++++++++-- 1 file changed, 69 insertions(+), 3 deletions(-) (limited to 'test/Parser/cxx-member-initializers.cpp') 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 struct X { + X(); + X(int); + }; + + struct A : X<0> { + A() : X{0}.n>() {} + + template struct a { + int n; + }; + + static const int b = 1; + }; + + struct B : X<0> { + B() : X{0} {} + + static const int a = 0, b = 0; + }; + + template struct a { + constexpr a(int) {} + constexpr operator int() const { return 0; } + }; + + struct C : X<0> { + C() : X(0)>() {} + + static const int b = 0; + }; + + struct D : X<0> { + D() : X(0) {} + + static const int a = 0, b = 0; + }; + + template struct E : X<0> { + E(X<0>) : X<(0)>{} {} + E(X<1>) : X{} {} + E(X<2>) : X<(0)>() {} + E(X<3>) : X() {} + }; + + // FIXME: This should be valid in the union of C99 and C++11. + struct F : X<0> { + F() : X().n + (T){}.n>{} {} // expected-error +{{}} + + struct T { int n; }; + template 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 ')'}} +} -- cgit v1.1