summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseDecl.cpp
diff options
context:
space:
mode:
authorFaisal Vali <faisalv@yahoo.com>2014-12-04 12:40:21 +0000
committerFaisal Vali <faisalv@yahoo.com>2014-12-04 12:40:21 +0000
commit8435a6938d6d7797d3c5b104d0943eefd46f9270 (patch)
tree763d6f30c3100f7a89b73a4c441c7dac9817cb72 /clang/lib/Parse/ParseDecl.cpp
parentb24d0abfe33b147fd381b13c3ea1051939f5d0c4 (diff)
downloadbcm5719-llvm-8435a6938d6d7797d3c5b104d0943eefd46f9270.tar.gz
bcm5719-llvm-8435a6938d6d7797d3c5b104d0943eefd46f9270.zip
Fix PR21684 - Ellipsis following an 'auto' parameter sans name/ID
should indicate a c++ parameter pack not a c-variadic. int i = [](auto...) { return 0; }(); // OK now. llvm-svn: 223357
Diffstat (limited to 'clang/lib/Parse/ParseDecl.cpp')
-rw-r--r--clang/lib/Parse/ParseDecl.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp
index 5af7b69999b..fc6c7cebe28 100644
--- a/clang/lib/Parse/ParseDecl.cpp
+++ b/clang/lib/Parse/ParseDecl.cpp
@@ -4873,19 +4873,20 @@ void Parser::ParseDirectDeclarator(Declarator &D) {
}
// C++0x [dcl.fct]p14:
- // There is a syntactic ambiguity when an ellipsis occurs at the end
- // of a parameter-declaration-clause without a preceding comma. In
- // this case, the ellipsis is parsed as part of the
- // abstract-declarator if the type of the parameter names a template
- // parameter pack that has not been expanded; otherwise, it is parsed
- // as part of the parameter-declaration-clause.
+ // There is a syntactic ambiguity when an ellipsis occurs at the end of a
+ // parameter-declaration-clause without a preceding comma. In this case,
+ // the ellipsis is parsed as part of the abstract-declarator if the type
+ // of the parameter either names a template parameter pack that has not
+ // been expanded or contains auto; otherwise, it is parsed as part of the
+ // parameter-declaration-clause.
if (Tok.is(tok::ellipsis) && D.getCXXScopeSpec().isEmpty() &&
!((D.getContext() == Declarator::PrototypeContext ||
D.getContext() == Declarator::LambdaExprParameterContext ||
D.getContext() == Declarator::BlockLiteralContext) &&
NextToken().is(tok::r_paren) &&
!D.hasGroupingParens() &&
- !Actions.containsUnexpandedParameterPacks(D))) {
+ !Actions.containsUnexpandedParameterPacks(D) &&
+ D.getDeclSpec().getTypeSpecType() != TST_auto)) {
SourceLocation EllipsisLoc = ConsumeToken();
if (isPtrOperatorToken(Tok.getKind(), getLangOpts(), D.getContext())) {
// The ellipsis was put in the wrong place. Recover, and explain to
OpenPOWER on IntegriCloud