C++11 attributes after 'constructor-name (' unambiguously signal that we have a

constructor.

llvm-svn: 190111
This commit is contained in:
Richard Smith 2013-09-06 00:12:20 +00:00
parent 8bc633ac09
commit f216366e64
2 changed files with 14 additions and 0 deletions

View File

@ -4234,6 +4234,15 @@ bool Parser::isConstructorDeclarator() {
return true;
}
// A C++11 attribute here signals that we have a constructor, and is an
// attribute on the first constructor parameter.
if (getLangOpts().CPlusPlus11 &&
isCXX11AttributeSpecifier(/*Disambiguate*/ false,
/*OuterMightBeMessageSend*/ true)) {
TPA.Revert();
return true;
}
// If we need to, enter the specified scope.
DeclaratorScopeObj DeclScopeObj(*this, SS);
if (SS.isSet() && Actions.ShouldEnterDeclaratorScope(getCurScope(), SS))

View File

@ -281,3 +281,8 @@ int v5()[[gnu::unused]]; // expected-warning {{attribute 'unused' ignored}}
[[attribute_declaration]]; // expected-warning {{unknown attribute 'attribute_declaration' ignored}}
[[noreturn]]; // expected-error {{'noreturn' attribute only applies to functions and methods}}
[[carries_dependency]]; // expected-error {{'carries_dependency' attribute only applies to functions, methods, and parameters}}
class A {
A([[gnu::unused]] int a);
};
A::A([[gnu::unused]] int a) {}