<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=utf-8" http-equiv=Content-Type>
<STYLE>
BLOCKQUOTE {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; MARGIN-LEFT: 2em
}
OL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
UL {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
P {
        MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px
}
BODY {
        LINE-HEIGHT: 1.5; FONT-FAMILY: 微软雅黑; COLOR: #000080; FONT-SIZE: 10.5pt
}
</STYLE>

<META name=GENERATOR content="MSHTML 9.00.8112.16470"></HEAD>
<BODY style="MARGIN: 10px">
<DIV> </DIV>
<DIV>Hello, Rafael.</DIV>
<DIV> </DIV>
<DIV style="TEXT-INDENT: 2em"> I've commited it with a bug id 15633 .</DIV>
<DIV> </DIV>
<HR style="WIDTH: 210px; HEIGHT: 1px" align=left color=#b5c4df SIZE=1>

<DIV><SPAN>zhangxiongpang</SPAN></DIV>
<DIV> </DIV>
<DIV 
style="BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0cm; PADDING-LEFT: 0cm; PADDING-RIGHT: 0cm; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt">
<DIV 
style="PADDING-BOTTOM: 8px; PADDING-LEFT: 8px; PADDING-RIGHT: 8px; BACKGROUND: #efefef; COLOR: #000000; FONT-SIZE: 12px; PADDING-TOP: 8px">
<DIV><B>From:</B> <A href="mailto:rafael.espindola@gmail.com">Rafael 
Espíndola</A></DIV>
<DIV><B>Date:</B> 2013-04-01 21:10</DIV>
<DIV><B>To:</B> <A 
href="mailto:zhangxiongpang@gmail.com">ZhangXiongpang</A></DIV>
<DIV><B>CC:</B> <A href="mailto:cfe-dev@cs.uiuc.edu">clang-dev 
Developers</A></DIV>
<DIV><B>Subject:</B> Re: [cfe-dev] [C++11][Forwarding declaration of 
enumerations] a bug involving defining enumeration outside of template class 
body</DIV></DIV></DIV>
<DIV>
<DIV>Can you please report a bug in llvm.org/bugs?</DIV>
<DIV> </DIV>
<DIV>Thanks,</DIV>
<DIV>Rafael</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>On 1 April 2013 03:39, ZhangXiongpang <zhangxiongpang@gmail.com> wrote:</DIV>
<DIV>> Platform: linux, x86_84, clang++3.3 (trunk 177699), g++4.7.2</DIV>
<DIV>></DIV>
<DIV>> Today I wrote some code testing c++11 "Forwarding declaration of</DIV>
<DIV>> enumerations".</DIV>
<DIV>> And a strange thing occurred. The following code makes clang++ core dump and</DIV>
<DIV>> makes g++ got into a dead loop.</DIV>
<DIV>> ----------------------------------</DIV>
<DIV>> template <class T></DIV>
<DIV>> struct X {</DIV>
<DIV>>     struct Y {</DIV>
<DIV>>         enum class E : T;</DIV>
<DIV>>     };</DIV>
<DIV>> };</DIV>
<DIV>></DIV>
<DIV>> template <class T></DIV>
<DIV>> enum class X<T>::Y::E : T { e1, e2 };</DIV>
<DIV>></DIV>
<DIV>> template class X<int>;</DIV>
<DIV>> ----------------------------------</DIV>
<DIV>></DIV>
<DIV>> The core dump information is as follows:</DIV>
<DIV>> ----------------------------------</DIV>
<DIV>> clang:</DIV>
<DIV>> /root/work/newdisk/zhang/llvm/llvm/tools/clang/lib/Sema/SemaTemplate.cpp:863:</DIV>
<DIV>> clang::DeclResult clang::Sema::CheckClassTemplate(clang::Scope*, unsigned</DIV>
<DIV>> int, clang::Sema::TagUseKind, clang::SourceLocation, clang::CXXScopeSpec&,</DIV>
<DIV>> clang::IdentifierInfo*, clang::SourceLocation, clang::AttributeList*,</DIV>
<DIV>> clang::TemplateParameterList*, clang::AccessSpecifier,</DIV>
<DIV>> clang::SourceLocation, unsigned int, clang::TemplateParameterList**):</DIV>
<DIV>> Assertion `Kind != TTK_Enum && "can't build template of enumerated type"'</DIV>
<DIV>> failed.</DIV>
<DIV>> 0  clang           0x0000000002f4e50d llvm::sys::PrintStackTrace(_IO_FILE*)</DIV>
<DIV>> + 38</DIV>
<DIV>> 1  clang           0x0000000002f4e78a</DIV>
<DIV>> 2  clang           0x0000000002f4e1e2</DIV>
<DIV>> 3  libpthread.so.0 0x0000003ffd40f4c0</DIV>
<DIV>> 4  libc.so.6       0x0000003ffcc329a5 gsignal + 53</DIV>
<DIV>> 5  libc.so.6       0x0000003ffcc34185 abort + 373</DIV>
<DIV>> 6  libc.so.6       0x0000003ffcc2b935 __assert_fail + 245</DIV>
<DIV>> 7  clang           0x00000000014514e6</DIV>
<DIV>> clang::Sema::CheckClassTemplate(clang::Scope*, unsigned int,</DIV>
<DIV>> clang::Sema::TagUseKind, clang::SourceLocation, clang::CXXScopeSpec&,</DIV>
<DIV>> clang::IdentifierInfo*, clang::SourceLocation, clang::AttributeList*,</DIV>
<DIV>> clang::TemplateParameterList*, clang::AccessSpecifier,</DIV>
<DIV>> clang::SourceLocation, unsigned int, clang::TemplateParameterList**) + 290</DIV>
<DIV>> 8  clang           0x0000000001222119 clang::Sema::ActOnTag(clang::Scope*,</DIV>
<DIV>> unsigned int, clang::Sema::TagUseKind, clang::SourceLocation,</DIV>
<DIV>> clang::CXXScopeSpec&, clang::IdentifierInfo*, clang::SourceLocation,</DIV>
<DIV>> clang::AttributeList*, clang::AccessSpecifier, clang::SourceLocation,</DIV>
<DIV>> llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&, bool&,</DIV>
<DIV>> clang::SourceLocation, bool,</DIV>
<DIV>> clang::ActionResult<clang::OpaquePtr&lt;clang::QualType>, false>) + 637</DIV>
<DIV>> 9  clang           0x00000000010fe46c</DIV>
<DIV>> clang::Parser::ParseEnumSpecifier(clang::SourceLocation, clang::DeclSpec&,</DIV>
<DIV>> clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,</DIV>
<DIV>> clang::Parser::DeclSpecContext) + 4258</DIV>
<DIV>> 10 clang           0x00000000010fc207</DIV>
<DIV>> clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,</DIV>
<DIV>> clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,</DIV>
<DIV>> clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 9139</DIV>
<DIV>> 11 clang           0x000000000114b09b</DIV>
<DIV>> clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,</DIV>
<DIV>> clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,</DIV>
<DIV>> clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 425</DIV>
<DIV>> 12 clang           0x000000000114aea4</DIV>
<DIV>> clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,</DIV>
<DIV>> clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) +</DIV>
<DIV>> 1046</DIV>
<DIV>> 13 clang           0x000000000114a9e5</DIV>
<DIV>> clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,</DIV>
<DIV>> clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 217</DIV>
<DIV>> 14 clang           0x00000000010f6d0e</DIV>
<DIV>> clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&,</DIV>
<DIV>> unsigned int, clang::SourceLocation&,</DIV>
<DIV>> clang::Parser::ParsedAttributesWithRange&) + 242</DIV>
<DIV>> 15 clang           0x00000000010e5a32</DIV>
<DIV>> clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,</DIV>
<DIV>> clang::ParsingDeclSpec*) + 1622</DIV>
<DIV>> 16 clang           0x00000000010e53ab</DIV>
<DIV>> clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) +</DIV>
<DIV>> 413</DIV>
<DIV>> 17 clang           0x00000000010e1db2 clang::ParseAST(clang::Sema&, bool,</DIV>
<DIV>> bool) + 610</DIV>
<DIV>> 18 clang           0x0000000000cd5ef4</DIV>
<DIV>> clang::ASTFrontendAction::ExecuteAction() + 298</DIV>
<DIV>> 19 clang           0x0000000000f056e6 clang::CodeGenAction::ExecuteAction()</DIV>
<DIV>> + 1296</DIV>
<DIV>> 20 clang           0x0000000000cd5a76 clang::FrontendAction::Execute() + 200</DIV>
<DIV>> 21 clang           0x0000000000caabc4</DIV>
<DIV>> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 722</DIV>
<DIV>> 22 clang           0x0000000000c7acee</DIV>
<DIV>> clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1048</DIV>
<DIV>> 23 clang           0x0000000000c6ab87 cc1_main(char const**, char const**,</DIV>
<DIV>> char const*, void*) + 673</DIV>
<DIV>> 24 clang           0x0000000000c7528d main + 484</DIV>
<DIV>> 25 libc.so.6       0x0000003ffcc1ec5d __libc_start_main + 253</DIV>
<DIV>> 26 clang           0x0000000000c6a309</DIV>
<DIV>> Stack dump:</DIV>
<DIV>> 0.      Program arguments:</DIV>
<DIV>> /root/work/newdisk/zhang/llvm/build/Debug+Asserts/bin/clang -cc1 -triple</DIV>
<DIV>> x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name</DIV>
<DIV>> test.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno</DIV>
<DIV>> -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64</DIV>
<DIV>> -target-linker-version 2.20.51.0.2 -momit-leaf-frame-pointer -coverage-file</DIV>
<DIV>> /root/work/newdisk/zhang/c++11/20130401/forward_declarations_for_enums/test.o</DIV>
<DIV>> -resource-dir</DIV>
<DIV>> /root/work/newdisk/zhang/llvm/build/Debug+Asserts/bin/../lib/clang/3.3</DIV>
<DIV>> -I/opt/intel/composer_xe_2013.1.117/mkl/include</DIV>
<DIV>> -I/opt/intel/composer_xe_2013.1.117/tbb/include -internal-isystem</DIV>
<DIV>> /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4</DIV>
<DIV>> -internal-isystem</DIV>
<DIV>> /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/x86_64-redhat-linux</DIV>
<DIV>> -internal-isystem</DIV>
<DIV>> /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/backward</DIV>
<DIV>> -internal-isystem</DIV>
<DIV>> /usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/x86_64-redhat-linux/c++/4.4.4</DIV>
<DIV>> -internal-isystem /usr/local/include -internal-isystem</DIV>
<DIV>> /root/work/newdisk/zhang/llvm/build/Debug+Asserts/bin/../lib/clang/3.3/include</DIV>
<DIV>> -internal-externc-isystem /include -internal-externc-isystem /usr/include</DIV>
<DIV>> -std=c++11 -fdeprecated-macro -fdebug-compilation-dir</DIV>
<DIV>> /root/work/newdisk/zhang/c++11/20130401/forward_declarations_for_enums</DIV>
<DIV>> -ferror-limit 19 -fmessage-length 114 -mstackrealign -fobjc-runtime=gcc</DIV>
<DIV>> -fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions</DIV>
<DIV>> -fdiagnostics-show-option -fcolor-diagnostics -backend-option</DIV>
<DIV>> -vectorize-loops -o test.o -x c++ test.cpp</DIV>
<DIV>> 1.      test.cpp:11:27: current parser token '{'</DIV>
<DIV>> clang: error: unable to execute command: Aborted (core dumped)</DIV>
<DIV>> clang: error: clang frontend command failed due to signal (use -v to see</DIV>
<DIV>> invocation)</DIV>
<DIV>> clang version 3.3 (trunk 177699) (llvm/trunk 177691)</DIV>
<DIV>> Target: x86_64-unknown-linux-gnu</DIV>
<DIV>> Thread model: posix</DIV>
<DIV>> clang: note: diagnostic msg: PLEASE submit a bug report to</DIV>
<DIV>> http://llvm.org/bugs/ and include the crash backtrace, preprocessed source,</DIV>
<DIV>> and associated run script.</DIV>
<DIV>> clang: note: diagnostic msg:</DIV>
<DIV>> ********************</DIV>
<DIV>></DIV>
<DIV>> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:</DIV>
<DIV>> Preprocessed source(s) and associated run script(s) are located at:</DIV>
<DIV>> clang: note: diagnostic msg: /tmp/test-9ucxjN.cpp</DIV>
<DIV>> clang: note: diagnostic msg: /tmp/test-9ucxjN.sh</DIV>
<DIV>> clang: note: diagnostic msg:</DIV>
<DIV>></DIV>
<DIV>> ********************</DIV>
<DIV>> ----------------------------------</DIV>
<DIV>></DIV>
<DIV>></DIV>
<DIV>></DIV>
<DIV>></DIV>
<DIV>> --</DIV>
<DIV>> View this message in context: http://clang-developers.42468.n3.nabble.com/C-11-Forwarding-declaration-of-enumerations-a-bug-involving-defining-enumeration-outside-of-templatey-tp4031237.html</DIV>
<DIV>> Sent from the Clang Developers mailing list archive at Nabble.com.</DIV>
<DIV>> _______________________________________________</DIV>
<DIV>> cfe-dev mailing list</DIV>
<DIV>> cfe-dev@cs.uiuc.edu</DIV>
<DIV>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</DIV></DIV></BODY></HTML>