From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- .../instantiate-member-initializers.cpp | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 clang/test/SemaTemplate/instantiate-member-initializers.cpp (limited to 'clang/test/SemaTemplate/instantiate-member-initializers.cpp') diff --git a/clang/test/SemaTemplate/instantiate-member-initializers.cpp b/clang/test/SemaTemplate/instantiate-member-initializers.cpp new file mode 100644 index 0000000..45503b3 --- /dev/null +++ b/clang/test/SemaTemplate/instantiate-member-initializers.cpp @@ -0,0 +1,27 @@ +// RUN: %clang_cc1 -fsyntax-only -Wall -verify %s + +template struct A { + A() : a(1) { } // expected-error{{cannot initialize a member subobject of type 'void *' with an rvalue of type 'int'}} + + T a; +}; + +A a0; +A a1; // expected-note{{in instantiation of member function 'A::A' requested here}} + +template struct B { + B() : b(1), // expected-warning {{field 'b' will be initialized after field 'a'}} + a(2) { } + + int a; + int b; +}; + +B b0; // expected-note {{in instantiation of member function 'B::B' requested here}} + +template struct AA { AA(int); }; +template class BB : public AA { +public: + BB() : AA(1) {} +}; +BB x; -- cgit v1.2.3