[cfe-commits] r134515 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaTemplate/instantiate-try-catch.cpp

Douglas Gregor dgregor at apple.com
Wed Jul 6 11:14:44 PDT 2011


Author: dgregor
Date: Wed Jul  6 13:14:43 2011
New Revision: 134515

URL: http://llvm.org/viewvc/llvm-project?rev=134515&view=rev
Log:
Don't try to type-check a copy construction of an exception
declaration with dependent type. Fixes PR10232 /
<rdar://problem/9700653>.

Modified:
    cfe/trunk/lib/Sema/SemaDeclCXX.cpp
    cfe/trunk/test/SemaTemplate/instantiate-try-catch.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=134515&r1=134514&r2=134515&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Wed Jul  6 13:14:43 2011
@@ -8046,7 +8046,7 @@
                                     ExDeclType, TInfo, SC_None, SC_None);
   ExDecl->setExceptionVariable(true);
   
-  if (!Invalid) {
+  if (!Invalid && !ExDeclType->isDependentType()) {
     if (const RecordType *recordType = ExDeclType->getAs<RecordType>()) {
       // C++ [except.handle]p16:
       //   The object declared in an exception-declaration or, if the 

Modified: cfe/trunk/test/SemaTemplate/instantiate-try-catch.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-try-catch.cpp?rev=134515&r1=134514&r2=134515&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-try-catch.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-try-catch.cpp Wed Jul  6 13:14:43 2011
@@ -12,3 +12,20 @@
 template struct TryCatch0<int&&>; // expected-note{{instantiation}}
 template struct TryCatch0<int>; // expected-note{{instantiation}}
 
+
+namespace PR10232 {
+  template <typename T>
+  class Templated {
+    struct Exception {
+    private:
+      Exception(const Exception&); // expected-note{{declared private here}}
+    };
+    void exception() {
+      try {
+      } catch(Exception e) {  // expected-error{{calling a private constructor of class 'PR10232::Templated<int>::Exception'}}
+      }
+    }
+  };
+
+  template class Templated<int>; // expected-note{{in instantiation of member function 'PR10232::Templated<int>::exception' requested here}}
+}





More information about the cfe-commits mailing list