r217997 - Skip parens when detecting whether we're instantiating a function declaration.

Richard Smith richard-llvm at metafoo.co.uk
Wed Sep 17 17:12:09 PDT 2014


Author: rsmith
Date: Wed Sep 17 19:12:09 2014
New Revision: 217997

URL: http://llvm.org/viewvc/llvm-project?rev=217997&view=rev
Log:
Skip parens when detecting whether we're instantiating a function declaration.

Modified:
    cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
    cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=217997&r1=217996&r2=217997&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Wed Sep 17 19:12:09 2014
@@ -1577,8 +1577,8 @@ TypeSourceInfo *Sema::SubstFunctionDeclT
 
   QualType Result;
 
-  // FIXME: What if the function type is parenthesized?
-  if (FunctionProtoTypeLoc Proto = TL.getAs<FunctionProtoTypeLoc>()) {
+  if (FunctionProtoTypeLoc Proto =
+          TL.IgnoreParens().getAs<FunctionProtoTypeLoc>()) {
     // Instantiate the type, other than its exception specification. The
     // exception specification is instantiated in InitFunctionInstantiation
     // once we've built the FunctionDecl.

Modified: cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp?rev=217997&r1=217996&r2=217997&view=diff
==============================================================================
--- cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp (original)
+++ cfe/trunk/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp Wed Sep 17 19:12:09 2014
@@ -58,6 +58,13 @@ namespace dr1330_example {
     S().f<S>(); // ok
     S().f<int>(); // expected-note {{instantiation of exception spec}}
   }
+
+  template<typename T>
+  struct U {
+    void f() noexcept(T::error);
+    void (g)() noexcept(T::error);
+  };
+  U<int> uint; // ok
 }
 
 namespace core_19754_example {





More information about the cfe-commits mailing list