diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-10-06 00:07:55 +0000 | 
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2008-10-06 00:07:55 +0000 | 
| commit | e8addf5e04dbdb34b1a47dcaa9605eb6826059c1 (patch) | |
| tree | 015fc4db998524d77aa4b84198b5434d97637ca5 | |
| parent | b83162840fa05e192919b9d174703a889986baa5 (diff) | |
| download | bcm5719-llvm-e8addf5e04dbdb34b1a47dcaa9605eb6826059c1.tar.gz bcm5719-llvm-e8addf5e04dbdb34b1a47dcaa9605eb6826059c1.zip  | |
Allow variadic arguments without named ones for C++, e.g. "void(...);"
llvm-svn: 57143
| -rw-r--r-- | clang/lib/Parse/ParseDecl.cpp | 3 | ||||
| -rw-r--r-- | clang/test/Parser/cxx-variadic-func.cpp | 5 | 
2 files changed, 7 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseDecl.cpp b/clang/lib/Parse/ParseDecl.cpp index c22d9e871b0..3017da48213 100644 --- a/clang/lib/Parse/ParseDecl.cpp +++ b/clang/lib/Parse/ParseDecl.cpp @@ -1233,6 +1233,7 @@ void Parser::ParseParenDeclarator(Declarator &D) {      // paren, because we haven't seen the identifier yet.      isGrouping = true;    } else if (Tok.is(tok::r_paren) ||           // 'int()' is a function. +             (getLang().CPlusPlus && Tok.is(tok::ellipsis)) || // C++ int(...)               isDeclarationSpecifier()) {       // 'int(int)' is a function.      // This handles C99 6.7.5.3p11: in "typedef int X; void foo(X)", X is      // considered to be a type, not a K&R identifier-list. @@ -1326,7 +1327,7 @@ void Parser::ParseFunctionDeclarator(SourceLocation LParenLoc, Declarator &D) {        IsVariadic = true;        // Check to see if this is "void(...)" which is not allowed. -      if (ParamInfo.empty()) { +      if (!getLang().CPlusPlus && ParamInfo.empty()) {          // Otherwise, parse parameter type list.  If it starts with an          // ellipsis,  diagnose the malformed function.          Diag(Tok, diag::err_ellipsis_first_arg); diff --git a/clang/test/Parser/cxx-variadic-func.cpp b/clang/test/Parser/cxx-variadic-func.cpp new file mode 100644 index 00000000000..0ef8684c1af --- /dev/null +++ b/clang/test/Parser/cxx-variadic-func.cpp @@ -0,0 +1,5 @@ +// RUN: clang -fsyntax-only  %s
 +
 +void f(...) {
 +  int g(int(...));
 +}
  | 

