]> granicus.if.org Git - clang/commitdiff
Skip parens when detecting whether we're instantiating a function declaration.
authorRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 18 Sep 2014 00:12:09 +0000 (00:12 +0000)
committerRichard Smith <richard-llvm@metafoo.co.uk>
Thu, 18 Sep 2014 00:12:09 +0000 (00:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217997 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Sema/SemaTemplateInstantiate.cpp
test/SemaTemplate/instantiate-exception-spec-cxx11.cpp

index 5838f756885d5e1bbaaae5edf99c58786cb05a42..25b2802f029c75a1531a19a02686efdd34bcf2b4 100644 (file)
@@ -1577,8 +1577,8 @@ TypeSourceInfo *Sema::SubstFunctionDeclType(TypeSourceInfo *T,
 
   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.
index ae10399b9ad54977fe0486608bcbbb516e42f8c8..f62ef61758a46817ab580f60982fe20c511cbf4e 100644 (file)
@@ -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 {