[cfe-commits] r57646 - /cfe/trunk/lib/Sema/SemaType.cpp

Argiris Kirtzidis akyrtzi at gmail.com
Thu Oct 16 10:31:09 PDT 2008


Author: akirtzidis
Date: Thu Oct 16 12:31:08 2008
New Revision: 57646

URL: http://llvm.org/viewvc/llvm-project?rev=57646&view=rev
Log:
In C++, an empty parameter list indicates a function that takes no parameters.

Modified:
    cfe/trunk/lib/Sema/SemaType.cpp

Modified: cfe/trunk/lib/Sema/SemaType.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=57646&r1=57645&r2=57646&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaType.cpp (original)
+++ cfe/trunk/lib/Sema/SemaType.cpp Thu Oct 16 12:31:08 2008
@@ -406,8 +406,14 @@
       }
         
       if (FTI.NumArgs == 0) {
-        // Simple void foo(), where the incoming T is the result type.
-        T = Context.getFunctionTypeNoProto(T);
+        if (getLangOptions().CPlusPlus) {
+          // C++ 8.3.5p2: If the parameter-declaration-clause is empty, the
+          // function takes no arguments.
+          T = Context.getFunctionType(T, NULL, 0, FTI.isVariadic);
+        } else {
+          // Simple void foo(), where the incoming T is the result type.
+          T = Context.getFunctionTypeNoProto(T);
+        }
       } else if (FTI.ArgInfo[0].Param == 0) {
         // C99 6.7.5.3p3: Reject int(x,y,z) when it's not a function definition.
         Diag(FTI.ArgInfo[0].IdentLoc, diag::err_ident_list_in_fn_declaration);        





More information about the cfe-commits mailing list