From: Chris Lattner Date: Wed, 28 Nov 2007 18:51:29 +0000 (+0000) Subject: Fix a bug checking for 'int foo(void)' that didn't look through typedefs of void. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b751c28a1afc24b3fb8e2ff9a29005100a8685ab;p=clang Fix a bug checking for 'int foo(void)' that didn't look through typedefs of void. Bug pointed out by Michael Zolda, thanks! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44408 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Sema/SemaDecl.cpp b/Sema/SemaDecl.cpp index 5bd03d0128..88635c3bc5 100644 --- a/Sema/SemaDecl.cpp +++ b/Sema/SemaDecl.cpp @@ -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) { diff --git a/clang.xcodeproj/project.pbxproj b/clang.xcodeproj/project.pbxproj index 1585d851d9..db10ad3f44 100644 --- a/clang.xcodeproj/project.pbxproj +++ b/clang.xcodeproj/project.pbxproj @@ -766,7 +766,6 @@ 08FB7793FE84155DC02AAC07 /* Project object */ = { isa = PBXProject; buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "clang" */; - compatibilityVersion = "Xcode 2.4"; hasScannedForEncodings = 1; mainGroup = 08FB7794FE84155DC02AAC07 /* clang */; projectDirPath = ""; diff --git a/test/Sema/void_arg.c b/test/Sema/void_arg.c index ae5328a7e3..275a1c4864 100644 --- a/test/Sema/void_arg.c +++ b/test/Sema/void_arg.c @@ -19,3 +19,7 @@ void foo() { X = sizeof(int (Void)); } +// this is ok. +void bar(Void) { +} +