[cfe-commits] r57143 - in /cfe/trunk: lib/Parse/ParseDecl.cpp test/Parser/cxx-variadic-func.cpp
Argiris Kirtzidis
akyrtzi at gmail.com
Sun Oct 5 17:07:58 PDT 2008
Author: akirtzidis
Date: Sun Oct 5 19:07:55 2008
New Revision: 57143
URL: http://llvm.org/viewvc/llvm-project?rev=57143&view=rev
Log:
Allow variadic arguments without named ones for C++, e.g. "void(...);"
Added:
cfe/trunk/test/Parser/cxx-variadic-func.cpp
Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=57143&r1=57142&r2=57143&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Sun Oct 5 19:07:55 2008
@@ -1233,6 +1233,7 @@
// 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 @@
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);
Added: cfe/trunk/test/Parser/cxx-variadic-func.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/cxx-variadic-func.cpp?rev=57143&view=auto
==============================================================================
--- cfe/trunk/test/Parser/cxx-variadic-func.cpp (added)
+++ cfe/trunk/test/Parser/cxx-variadic-func.cpp Sun Oct 5 19:07:55 2008
@@ -0,0 +1,5 @@
+// RUN: clang -fsyntax-only %s
+
+void f(...) {
+ int g(int(...));
+}
More information about the cfe-commits
mailing list