Don't try to delay parsing the exception specification for a data member of a

class; we would never actually parse it and attach it to the type.

llvm-svn: 155426
This commit is contained in:
Richard Smith 2012-04-24 05:48:42 +00:00
parent 3dfb6d84c6
commit 2cc2b46683
2 changed files with 11 additions and 1 deletions

View File

@ -4270,6 +4270,8 @@ void Parser::ParseFunctionDeclarator(Declarator &D,
D.getDeclSpec().getStorageClassSpec()
!= DeclSpec::SCS_typedef &&
!D.getDeclSpec().isFriendSpecified());
for (unsigned i = 0, e = D.getNumTypeObjects(); Delayed && i != e; ++i)
Delayed &= D.getTypeObject(i).Kind == DeclaratorChunk::Paren;
ESpecType = tryParseExceptionSpecification(Delayed,
ESpecRange,
DynamicExceptions,

View File

@ -60,8 +60,16 @@ namespace test3 {
namespace PR12629 {
struct S {
static int (f)() throw();
static int ((((((g))))() throw(int)));
static int ((((((g))))() throw(U)));
int (*h)() noexcept(false);
static int (&i)() noexcept(true);
static int (*j)() throw(U); // expected-error {{type name}} \
// expected-error {{expected ')'}} expected-note {{to match}}
struct U {};
};
static_assert(noexcept(S::f()), "");
static_assert(!noexcept(S::g()), "");
static_assert(!noexcept(S().h()), "");
static_assert(noexcept(S::i()), "");
}