r177330 - [PCH] Fix assertion hit related to enum decls inside templated funtions.

Argyrios Kyrtzidis akyrtzi at gmail.com
Mon Mar 18 15:23:49 PDT 2013


Author: akirtzidis
Date: Mon Mar 18 17:23:49 2013
New Revision: 177330

URL: http://llvm.org/viewvc/llvm-project?rev=177330&view=rev
Log:
[PCH] Fix assertion hit related to enum decls inside templated funtions.

Report and suggested fix by Tom Honermann!
http://llvm.org/bugs/show_bug.cgi?id=13020

Modified:
    cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
    cfe/trunk/test/PCH/cxx-templates.h

Modified: cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriterDecl.cpp?rev=177330&r1=177329&r2=177330&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTWriterDecl.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriterDecl.cpp Mon Mar 18 17:23:49 2013
@@ -253,6 +253,7 @@ void ASTDeclWriter::VisitEnumDecl(EnumDe
       !D->isModulePrivate() &&
       !CXXRecordDecl::classofKind(D->getKind()) &&
       !D->getIntegerTypeSourceInfo() &&
+      !D->getMemberSpecializationInfo() &&
       D->getDeclName().getNameKind() == DeclarationName::Identifier)
     AbbrevToUse = Writer.getDeclEnumAbbrev();
 

Modified: cfe/trunk/test/PCH/cxx-templates.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/PCH/cxx-templates.h?rev=177330&r1=177329&r2=177330&view=diff
==============================================================================
--- cfe/trunk/test/PCH/cxx-templates.h (original)
+++ cfe/trunk/test/PCH/cxx-templates.h Mon Mar 18 17:23:49 2013
@@ -246,3 +246,16 @@ struct __mt_alloc {
   }
 };
 }
+
+namespace PR13020 {
+template<typename T>
+void f() {
+ enum E {
+   enumerator
+ };
+
+ T t = enumerator;
+}
+
+template void f<int>();
+}





More information about the cfe-commits mailing list