From aaf4d17a4a0c8bdc28f5032467e1237e937d59bc Mon Sep 17 00:00:00 2001 From: Richard Smith Date: Thu, 18 Sep 2014 00:12:09 +0000 Subject: [PATCH] Skip parens when detecting whether we're instantiating a function declaration. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@217997 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Sema/SemaTemplateInstantiate.cpp | 4 ++-- test/SemaTemplate/instantiate-exception-spec-cxx11.cpp | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp index 5838f75688..25b2802f02 100644 --- a/lib/Sema/SemaTemplateInstantiate.cpp +++ b/lib/Sema/SemaTemplateInstantiate.cpp @@ -1577,8 +1577,8 @@ TypeSourceInfo *Sema::SubstFunctionDeclType(TypeSourceInfo *T, QualType Result; - // FIXME: What if the function type is parenthesized? - if (FunctionProtoTypeLoc Proto = TL.getAs()) { + if (FunctionProtoTypeLoc Proto = + TL.IgnoreParens().getAs()) { // Instantiate the type, other than its exception specification. The // exception specification is instantiated in InitFunctionInstantiation // once we've built the FunctionDecl. diff --git a/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp b/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp index ae10399b9a..f62ef61758 100644 --- a/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp +++ b/test/SemaTemplate/instantiate-exception-spec-cxx11.cpp @@ -58,6 +58,13 @@ namespace dr1330_example { S().f(); // ok S().f(); // expected-note {{instantiation of exception spec}} } + + template + struct U { + void f() noexcept(T::error); + void (g)() noexcept(T::error); + }; + U uint; // ok } namespace core_19754_example { -- 2.40.0