<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Approved.<div><br></div><div><span class="Apple-tab-span" style="white-space:pre">       </span>- Doug</div><div><br><div><div>On Apr 27, 2012, at 12:38 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="gmail_extra">Requesting a port to the 3.1 branch, in an attempt to stem the inevitable stream of bug reports for a feature which we don't reject, but doesn't work (cf lambdas in 3.0).<br><br><div class="gmail_quote">
On Fri, Apr 27, 2012 at 12:33 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard-llvm@metafoo.co.uk" target="_blank">richard-llvm@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: rsmith<br>
Date: Fri Apr 27 14:33:05 2012<br>
New Revision: 155728<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=155728&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=155728&view=rev</a><br>
Log:<br>
PR12224 (sort of): Diagnose inheriting constructor declarations in C++11 mode.<br>
We do not support IRGen for these, and get some parts of the semantic analysis<br>
wrong.<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp<br>
    cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp<br>
    cfe/trunk/test/CXX/special/class.inhctor/p3.cpp<br>
    cfe/trunk/test/CXX/special/class.inhctor/p7.cpp<br>
    cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp<br>
    cfe/trunk/test/SemaCXX/cxx98-compat.cpp<br>
<br>
Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=155728&r1=155727&r2=155728&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=155728&r1=155727&r2=155728&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)<br>
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Apr 27 14:33:05 2012<br>
@@ -231,9 +231,13 @@<br>
   "using declaration can not refer to namespace">;<br>
 def err_using_decl_constructor : Error<<br>
   "using declaration can not refer to a constructor">;<br>
-def warn_cxx98_compat_using_decl_constructor : Warning<<br>
-  "inherited constructors are incompatible with C++98">,<br>
-  InGroup<CXX98Compat>, DefaultIgnore;<br>
+def err_using_decl_constructor_unsupported : Error<<br>
+  "inheriting constructors are not supported">;<br>
+// FIXME: Replace the above error with this warning if support for<br>
+//        inheriting constructors is implemented.<br>
+//def warn_cxx98_compat_using_decl_constructor : Warning<<br>
+//  "inheriting constructors are incompatible with C++98">,<br>
+//  InGroup<CXX98Compat>, DefaultIgnore;<br>
 def err_using_decl_destructor : Error<<br>
   "using declaration can not refer to a destructor">;<br>
 def err_using_decl_template_id : Error<<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=155728&r1=155727&r2=155728&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=155728&r1=155727&r2=155728&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Apr 27 14:33:05 2012<br>
@@ -5925,10 +5925,12 @@<br>
<br>
   case UnqualifiedId::IK_ConstructorName:<br>
   case UnqualifiedId::IK_ConstructorTemplateId:<br>
-    // C++0x inherited constructors.<br>
+    // C++11 inheriting constructors.<br>
     Diag(Name.getLocStart(),<br>
          getLangOpts().CPlusPlus0x ?<br>
-           diag::warn_cxx98_compat_using_decl_constructor :<br>
+           // FIXME: Produce warn_cxx98_compat_using_decl_constructor<br>
+           //        instead once inheriting constructors work.<br>
+           diag::err_using_decl_constructor_unsupported :<br>
            diag::err_using_decl_constructor)<br>
       << SS.getRange();<br>
<br>
<br>
Modified: cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp?rev=155728&r1=155727&r2=155728&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp?rev=155728&r1=155727&r2=155728&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp (original)<br>
+++ cfe/trunk/test/CXX/special/class.inhctor/elsewhere.cpp Fri Apr 27 14:33:05 2012<br>
@@ -9,15 +9,15 @@<br>
   B1(int);<br>
 };<br>
<br>
-using B1::B1; // expected-error {{using declaration can not refer to class member}}<br>
+using B1::B1; // expected-error {{using declaration can not refer to class member}} expected-error {{not supported}}<br>
<br>
 // C++0x [namespace.udecl]p10:<br>
 //   A using-declaration is a declaration and can therefore be used repeatedly<br>
 //   where (and only where) multiple declarations are allowed.<br>
<br>
 struct I1 : B1 {<br>
-  using B1::B1; // expected-note {{previous using declaration}}<br>
-  using B1::B1; // expected-error {{redeclaration of using decl}}<br>
+  using B1::B1; // expected-note {{previous using declaration}} expected-error {{not supported}}<br>
+  using B1::B1; // expected-error {{redeclaration of using decl}} expected-error {{not supported}}<br>
 };<br>
<br>
 // C++0x [namespace.udecl]p3:<br>
@@ -27,31 +27,31 @@<br>
 //   shall name a direct base class of the class being defined.<br>
<br>
 struct D1 : I1 {<br>
-  using B1::B1; // expected-error {{'B1' is not a direct base of 'D1', can not inherit constructors}}<br>
+  using B1::B1; // expected-error {{'B1' is not a direct base of 'D1', can not inherit constructors}} expected-error {{not supported}}<br>
 };<br>
<br>
 template<typename T> struct A {};<br>
<br>
 template<typename T> struct B : A<bool>, A<char> {<br>
-  using A<T>::A; // expected-error {{'A<double>::', which is not a base class of 'B<double>'}}<br>
+  using A<T>::A; // expected-error {{'A<double>::', which is not a base class of 'B<double>'}} expected-error {{not supported}}<br>
 };<br>
 B<bool> bb;<br>
 B<char> bc;<br>
 B<double> bd; // expected-note {{here}}<br>
<br>
 template<typename T> struct C : A<T> {<br>
-  using A<bool>::A; // expected-error {{'A<bool>::', which is not a base class of 'C<char>'}}<br>
+  using A<bool>::A; // expected-error {{'A<bool>::', which is not a base class of 'C<char>'}} expected-error {{not supported}}<br>
 };<br>
 C<bool> cb;<br>
 C<char> cc; // expected-note {{here}}<br>
<br>
 template<typename T> struct D : A<T> {};<br>
 template<typename T> struct E : D<T> {<br>
-  using A<bool>::A; // expected-error {{'A<bool>' is not a direct base of 'E<bool>', can not inherit}}<br>
+  using A<bool>::A; // expected-error {{'A<bool>' is not a direct base of 'E<bool>', can not inherit}} expected-error {{not supported}}<br>
 };<br>
 E<bool> eb; // expected-note {{here}}<br>
<br>
 template<typename T> struct F : D<bool> {<br>
-  using A<T>::A; // expected-error {{'A<bool>' is not a direct base of 'F<bool>'}}<br>
+  using A<T>::A; // expected-error {{'A<bool>' is not a direct base of 'F<bool>'}} expected-error {{not supported}}<br>
 };<br>
 F<bool> fb; // expected-note {{here}}<br>
<br>
Modified: cfe/trunk/test/CXX/special/class.inhctor/p3.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/p3.cpp?rev=155728&r1=155727&r2=155728&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/p3.cpp?rev=155728&r1=155727&r2=155728&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/test/CXX/special/class.inhctor/p3.cpp (original)<br>
+++ cfe/trunk/test/CXX/special/class.inhctor/p3.cpp Fri Apr 27 14:33:05 2012<br>
@@ -5,7 +5,7 @@<br>
   B1(int, int);<br>
 };<br>
 struct D1 : B1 {<br>
-  using B1::B1;<br>
+  using B1::B1; // expected-error {{not supported}}<br>
 };<br>
 D1 d1a(1), d1b(1, 1);<br>
<br>
@@ -15,7 +15,7 @@<br>
   explicit B2(int, int = 0, int = 0);<br>
 };<br>
 struct D2 : B2 { // expected-note 2 {{candidate constructor}}<br>
-  using B2::B2;<br>
+  using B2::B2; // expected-error {{not supported}}<br>
 };<br>
 D2 d2a(1), d2b(1, 1), d2c(1, 1, 1);<br>
<br>
@@ -25,18 +25,18 @@<br>
   B3(void*); // expected-note {{inherited from here}}<br>
 };<br>
 struct D3 : B3 { // expected-note 2 {{candidate constructor}}<br>
-  using B3::B3; // expected-note {{candidate constructor (inherited)}}<br>
+  using B3::B3; // expected-note {{candidate constructor (inherited)}} expected-error {{not supported}}<br>
 };<br>
 D3 fd3() { return 1; } // expected-error {{no viable conversion}}<br>
<br>
 template<typename T> struct T1 : B1 {<br>
-  using B1::B1;<br>
+  using B1::B1; // expected-error {{not supported}}<br>
 };<br>
 template<typename T> struct T2 : T1<T> {<br>
-  using T1<int>::T1;<br>
+  using T1<int>::T1; // expected-error {{not supported}}<br>
 };<br>
 template<typename T> struct T3 : T1<int> {<br>
-  using T1<T>::T1;<br>
+  using T1<T>::T1; // expected-error {{not supported}}<br>
 };<br>
 struct U {<br>
   friend T1<int>::T1(int);<br>
<br>
Modified: cfe/trunk/test/CXX/special/class.inhctor/p7.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/p7.cpp?rev=155728&r1=155727&r2=155728&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/special/class.inhctor/p7.cpp?rev=155728&r1=155727&r2=155728&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/test/CXX/special/class.inhctor/p7.cpp (original)<br>
+++ cfe/trunk/test/CXX/special/class.inhctor/p7.cpp Fri Apr 27 14:33:05 2012<br>
@@ -8,12 +8,12 @@<br>
   B2(int); // expected-note {{conflicting constructor}}<br>
 };<br>
 struct D1 : B1, B2 {<br>
-  using B1::B1; // expected-note {{inherited here}}<br>
-  using B2::B2; // expected-error {{already inherited constructor with the same signature}}<br>
+  using B1::B1; // expected-note {{inherited here}} expected-error {{not supported}}<br>
+  using B2::B2; // expected-error {{already inherited constructor with the same signature}} expected-error {{not supported}}<br>
 };<br>
 struct D2 : B1, B2 {<br>
-  using B1::B1;<br>
-  using B2::B2;<br>
+  using B1::B1; // expected-error {{not supported}}<br>
+  using B2::B2; // expected-error {{not supported}}<br>
   D2(int);<br>
 };<br>
<br>
@@ -22,8 +22,8 @@<br>
 };<br>
 template<typename T> struct B4 : B3<T>, B1 {<br>
   B4();<br>
-  using B3<T>::B3; // expected-note {{inherited here}}<br>
-  using B1::B1; // expected-error {{already inherited}}<br>
+  using B3<T>::B3; // expected-note {{inherited here}} expected-error {{not supported}}<br>
+  using B1::B1; // expected-error {{already inherited}} expected-error {{not supported}}<br>
 };<br>
 B4<char> b4c;<br>
 B4<int> b4i; // expected-note {{here}}<br>
<br>
Modified: cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp?rev=155728&r1=155727&r2=155728&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp?rev=155728&r1=155727&r2=155728&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp (original)<br>
+++ cfe/trunk/test/CodeGenCXX/inheriting-constructor.cpp Fri Apr 27 14:33:05 2012<br>
@@ -1,5 +1,7 @@<br>
 // RUN: %clang_cc1 -std=c++11 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s<br>
<br>
+// XFAIL: *<br>
+<br>
 // PR12219<br>
 struct A { A(int); virtual ~A(); };<br>
 struct B : A { using A::A; ~B(); };<br>
<br>
Modified: cfe/trunk/test/SemaCXX/cxx98-compat.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx98-compat.cpp?rev=155728&r1=155727&r2=155728&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx98-compat.cpp?rev=155728&r1=155727&r2=155728&view=diff</a><br>

==============================================================================<br>
--- cfe/trunk/test/SemaCXX/cxx98-compat.cpp (original)<br>
+++ cfe/trunk/test/SemaCXX/cxx98-compat.cpp Fri Apr 27 14:33:05 2012<br>
@@ -138,12 +138,16 @@<br>
 void *null = nullptr; // expected-warning {{'nullptr' is incompatible with C++98}}<br>
 static_assert(true, "!"); // expected-warning {{static_assert declarations are incompatible with C++98}}<br>
<br>
+// FIXME: Reintroduce this test if support for inheriting constructors is<br>
+//        implemented.<br>
+#if 0<br>
 struct InhCtorBase {<br>
   InhCtorBase(int);<br>
 };<br>
 struct InhCtorDerived : InhCtorBase {<br>
-  using InhCtorBase::InhCtorBase; // expected-warning {{inherited constructors are incompatible with C++98}}<br>
+  using InhCtorBase::InhCtorBase; // xpected-warning {{inheriting constructors are incompatible with C++98}}<br>
 };<br>
+#endif<br>
<br>
 struct FriendMember {<br>
   static void MemberFn();<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>
</blockquote></div><br></div></body></html>