[C++11][Forwarding declaration of enumerations] a bug involving defining enumeration outside of template class body

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[C++11][Forwarding declaration of enumerations] a bug involving defining enumeration outside of template class body

ZhangXiongpang
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 http://llvm.org/bugs/ 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:

********************
----------------------------------
Reply | Threaded
Open this post in threaded view
|

Re: [C++11][Forwarding declaration of enumerations] a bug involving defining enumeration outside of template class body

Rafael Espíndola
Can you please report a bug in llvm.org/bugs?

Thanks,
Rafael


On 1 April 2013 03:39, ZhangXiongpang <[hidden email]> wrote:

> 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&lt;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
> http://llvm.org/bugs/ 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:
>
> ********************
> ----------------------------------
>
>
>
>
> --
> 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
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [C++11][Forwarding declaration of enumerations] a bug involving defining enumeration outside of template class body

ZhangXiongpang

 
Hello, Rafael.
 
 I've commited it with a bug id 15633 .
 

zhangxiongpang
 
Date: 2013-04-01 21:10
Subject: Re: [cfe-dev] [C++11][Forwarding declaration of enumerations] a bug involving defining enumeration outside of template class body
Can you please report a bug in llvm.org/bugs?
 
Thanks,
Rafael
 
 
On 1 April 2013 03:39, ZhangXiongpang <[hidden email]> wrote:
> 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&lt;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
> http://llvm.org/bugs/ 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:
>
> ********************
> ----------------------------------
>
>
>
>
> --
> 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
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: [C++11][Forwarding declaration of enumerations] a bug involving defining enumeration outside of template class body

Richard Smith
Fixed in r178502, thanks for the report.

On Mon, Apr 1, 2013 at 6:32 AM, zhangxiongpang <[hidden email]> wrote:
 
Hello, Rafael.
 
 I've commited it with a bug id 15633 .
 

zhangxiongpang
 
Date: <a href="tel:2013-04-01%C2%A021" value="+12013040121" target="_blank">2013-04-01 21:10
Subject: Re: [cfe-dev] [C++11][Forwarding declaration of enumerations] a bug involving defining enumeration outside of template class body
Can you please report a bug in llvm.org/bugs?
 
Thanks,
Rafael
 
 
On 1 April 2013 03:39, ZhangXiongpang <[hidden email]> wrote:
> 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&lt;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
http://llvm.org/bugs/ 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:
>
> ********************
> ----------------------------------
>
>
>
>
> --
> Sent from the Clang Developers mailing list archive at Nabble.com.
> _______________________________________________
> cfe-dev mailing list

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev