]> granicus.if.org Git - clang/commitdiff
Fix a bug checking for 'int foo(void)' that didn't look through typedefs of void.
authorChris Lattner <sabre@nondot.org>
Wed, 28 Nov 2007 18:51:29 +0000 (18:51 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 28 Nov 2007 18:51:29 +0000 (18:51 +0000)
Bug pointed out by Michael Zolda, thanks!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44408 91177308-0d34-0410-b5e6-96231b3b80d8

Sema/SemaDecl.cpp
clang.xcodeproj/project.pbxproj
test/Sema/void_arg.c

index 5bd03d01282751c3bbec937ae2dab0b3b2e1cbf1..88635c3bc5badd5cf8ace9f1a88b5cb1e8f664b0 100644 (file)
@@ -895,7 +895,8 @@ Sema::DeclTy *Sema::ActOnStartOfFunctionDef(Scope *FnBodyScope, Declarator &D) {
   // Check for C99 6.7.5.3p10 - foo(void) is a non-varargs function that takes
   // no arguments, not a function that takes a single void argument.
   if (FTI.NumArgs == 1 && !FTI.isVariadic && FTI.ArgInfo[0].Ident == 0 &&
-      FTI.ArgInfo[0].TypeInfo == Context.VoidTy.getAsOpaquePtr()) {
+      !QualType::getFromOpaquePtr(FTI.ArgInfo[0].TypeInfo).getQualifiers() &&
+      QualType::getFromOpaquePtr(FTI.ArgInfo[0].TypeInfo)->isVoidType()) {
     // empty arg list, don't push any params.
   } else {
     for (unsigned i = 0, e = FTI.NumArgs; i != e; ++i) {
index 1585d851d9ab75d8c3735019ca05102a2daa5db4..db10ad3f4485e2c426c967ccbb81ca21eff00545 100644 (file)
                08FB7793FE84155DC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */;
-                       compatibilityVersion = "Xcode 2.4";
                        hasScannedForEncodings = 1;
                        mainGroup = 08FB7794FE84155DC02AAC07 /* clang */;
                        projectDirPath = "";
index ae5328a7e33ae9e21ed00fbd4908a693f8d385b5..275a1c4864320f58aaf0f4acd98e307b71e5ad25 100644 (file)
@@ -19,3 +19,7 @@ void foo() {
   X = sizeof(int (Void));
 }
 
+// this is ok.
+void bar(Void) {
+}
+