[cfe-commits] r162886 - in /cfe/trunk: lib/AST/ASTContext.cpp test/Sema/function-redecl.c
Eli Friedman
eli.friedman at gmail.com
Wed Aug 29 17:44:15 PDT 2012
Author: efriedma
Date: Wed Aug 29 19:44:15 2012
New Revision: 162886
URL: http://llvm.org/viewvc/llvm-project?rev=162886&view=rev
Log:
Fix a crash in type merging with enum types.
Modified:
cfe/trunk/lib/AST/ASTContext.cpp
cfe/trunk/test/Sema/function-redecl.c
Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=162886&r1=162885&r2=162886&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Aug 29 19:44:15 2012
@@ -6413,10 +6413,13 @@
for (unsigned i = 0; i < proto_nargs; ++i) {
QualType argTy = proto->getArgType(i);
- // Look at the promotion type of enum types, since that is the type used
+ // Look at the converted type of enum types, since that is the type used
// to pass enum values.
- if (const EnumType *Enum = argTy->getAs<EnumType>())
- argTy = Enum->getDecl()->getPromotionType();
+ if (const EnumType *Enum = argTy->getAs<EnumType>()) {
+ argTy = Enum->getDecl()->getIntegerType();
+ if (argTy.isNull())
+ return QualType();
+ }
if (argTy->isPromotableIntegerType() ||
getCanonicalType(argTy).getUnqualifiedType() == FloatTy)
Modified: cfe/trunk/test/Sema/function-redecl.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/function-redecl.c?rev=162886&r1=162885&r2=162886&view=diff
==============================================================================
--- cfe/trunk/test/Sema/function-redecl.c (original)
+++ cfe/trunk/test/Sema/function-redecl.c Wed Aug 29 19:44:15 2012
@@ -129,3 +129,7 @@
enum e0 {one};
void f3();
void f3(enum e0 x) {}
+
+enum incomplete_enum;
+void f4(); // expected-note {{previous declaration is here}}
+void f4(enum incomplete_enum); // expected-error {{conflicting types for 'f4'}}
More information about the cfe-commits
mailing list