<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - a bug involving defining enumeration outside of template class body"
   href="http://llvm.org/bugs/show_bug.cgi?id=15633">15633</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>a bug involving defining enumeration outside of template class body
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++11
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>zhangxiongpang@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Platform: linux, x86_84, clang++3.3 (trunk 177699), g++4.7.2

Today I wrote some code testing c++11 "Forwarding declaration of enumerations".
And a strange thing occurred. The following code makes clang++ core dump and
makes g++ got into a dead loop.
----------------------------------
template <class T>
struct X {
    struct Y {
        enum class E : T;
    };
};

template <class T>
enum class X<T>::Y::E : T { e1, e2 };

template class X<int>;
----------------------------------

The core dump information is as follows:
----------------------------------
clang:
/root/work/newdisk/zhang/llvm/llvm/tools/clang/lib/Sema/SemaTemplate.cpp:863:
clang::DeclResult clang::Sema::CheckClassTemplate(clang::Scope*, unsigned int,
clang::Sema::TagUseKind, clang::SourceLocation, clang::CXXScopeSpec&,
clang::IdentifierInfo*, clang::SourceLocation, clang::AttributeList*,
clang::TemplateParameterList*, clang::AccessSpecifier, clang::SourceLocation,
unsigned int, clang::TemplateParameterList**): Assertion `Kind != TTK_Enum &&
"can't build template of enumerated type"' failed.
0  clang           0x0000000002f4e50d llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  clang           0x0000000002f4e78a
2  clang           0x0000000002f4e1e2
3  libpthread.so.0 0x0000003ffd40f4c0
4  libc.so.6       0x0000003ffcc329a5 gsignal + 53
5  libc.so.6       0x0000003ffcc34185 abort + 373
6  libc.so.6       0x0000003ffcc2b935 __assert_fail + 245
7  clang           0x00000000014514e6
clang::Sema::CheckClassTemplate(clang::Scope*, unsigned int,
clang::Sema::TagUseKind, clang::SourceLocation, clang::CXXScopeSpec&,
clang::IdentifierInfo*, clang::SourceLocation, clang::AttributeList*,
clang::TemplateParameterList*, clang::AccessSpecifier, clang::SourceLocation,
unsigned int, clang::TemplateParameterList**) + 290
8  clang           0x0000000001222119 clang::Sema::ActOnTag(clang::Scope*,
unsigned int, clang::Sema::TagUseKind, clang::SourceLocation,
clang::CXXScopeSpec&, clang::IdentifierInfo*, clang::SourceLocation,
clang::AttributeList*, clang::AccessSpecifier, clang::SourceLocation,
llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&, bool&,
clang::SourceLocation, bool,
clang::ActionResult<clang::OpaquePtr<clang::QualType>, false>) + 637
9  clang           0x00000000010fe46c
clang::Parser::ParseEnumSpecifier(clang::SourceLocation, clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext) + 4258
10 clang           0x00000000010fc207
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*) + 9139
11 clang           0x000000000114b09b
clang::Parser::ParseSingleDeclarationAfterTemplate(unsigned int,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 425
12 clang           0x000000000114aea4
clang::Parser::ParseTemplateDeclarationOrSpecialization(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 1046
13 clang           0x000000000114a9e5
clang::Parser::ParseDeclarationStartingWithTemplate(unsigned int,
clang::SourceLocation&, clang::AccessSpecifier, clang::AttributeList*) + 217
14 clang           0x00000000010f6d0e
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 242
15 clang           0x00000000010e5a32
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 1622
16 clang           0x00000000010e53ab
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 413
17 clang           0x00000000010e1db2 clang::ParseAST(clang::Sema&, bool, bool)
+ 610
18 clang           0x0000000000cd5ef4 clang::ASTFrontendAction::ExecuteAction()
+ 298
19 clang           0x0000000000f056e6 clang::CodeGenAction::ExecuteAction() +
1296
20 clang           0x0000000000cd5a76 clang::FrontendAction::Execute() + 200
21 clang           0x0000000000caabc4
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 722
22 clang           0x0000000000c7acee
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1048
23 clang           0x0000000000c6ab87 cc1_main(char const**, char const**, char
const*, void*) + 673
24 clang           0x0000000000c7528d main + 484
25 libc.so.6       0x0000003ffcc1ec5d __libc_start_main + 253
26 clang           0x0000000000c6a309
Stack dump:
0.      Program arguments:
/root/work/newdisk/zhang/llvm/build/Debug+Asserts/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
test.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -target-cpu x86-64 -target-linker-version
2.20.51.0.2 -momit-leaf-frame-pointer -coverage-file
/root/work/newdisk/zhang/c++11/20130401/forward_declarations_for_enums/test.o
-resource-dir
/root/work/newdisk/zhang/llvm/build/Debug+Asserts/bin/../lib/clang/3.3
-I/opt/intel/composer_xe_2013.1.117/mkl/include
-I/opt/intel/composer_xe_2013.1.117/tbb/include -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/c++/4.4.4/backward
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.4.4/../../../../include/x86_64-redhat-linux/c++/4.4.4
-internal-isystem /usr/local/include -internal-isystem
/root/work/newdisk/zhang/llvm/build/Debug+Asserts/bin/../lib/clang/3.3/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/root/work/newdisk/zhang/c++11/20130401/forward_declarations_for_enums
-ferror-limit 19 -fmessage-length 114 -mstackrealign -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops
-o test.o -x c++ test.cpp
1.      test.cpp:11:27: current parser token '{'
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.3 (trunk 177699) (llvm/trunk 177691)
Target: x86_64-unknown-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/test-9ucxjN.cpp
clang: note: diagnostic msg: /tmp/test-9ucxjN.sh
clang: note: diagnostic msg:

********************
----------------------------------</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>