<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 --- - clang crash on enum class ParseDeclarationAfterDeclaratorAndAttributes"
href="http://llvm.org/bugs/show_bug.cgi?id=19282">19282</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang crash on enum class ParseDeclarationAfterDeclaratorAndAttributes
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.3
</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>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>designfu@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Created <span class=""><a href="attachment.cgi?id=12309" name="attach_12309" title="test-AsAoDp.cpp">attachment 12309</a> <a href="attachment.cgi?id=12309&action=edit" title="test-AsAoDp.cpp">[details]</a></span>
test-AsAoDp.cpp
Reporting in case this bug hasn't been fixed in 3.4 - I have not tested.
Crashing code:
int main( int argc, char* argv[] )
{
enum class MyEnumClass { ONE, TWO, THREE };
MyEnumClass& MyEnumClass::operator++( MyEnumClass& ) { }
MyEnumClass eC = MyEnumClass::TWO;
return 0;
}
This crashes Clang 3.3-RELEASE with the following
./clang++ --std=c++11 -o test test.cpp -Wall -Wextra
test.cpp:4:55: error: function definition is not allowed here
MyEnumClass& MyEnumClass::operator++( MyEnumClass& ) { }
^
Unexpected context
UNREACHABLE executed at
/home/erbacc/clang/llvm-3.3.src/tools/clang/lib/Sema/SemaDecl.cpp:4692!
0 clang 0x000000000229f322 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1 clang 0x00000000022a158a
2 libpthread.so.0 0x0000003ff000f4a0
3 libc.so.6 0x0000003fef832885 gsignal + 53
4 libc.so.6 0x0000003fef834065 abort + 373
5 clang 0x00000000022880c2 llvm::llvm_unreachable_internal(char
const*, char const*, unsigned int) + 354
6 clang 0x0000000000b35639
clang::Sema::ActOnFunctionDeclarator(clang::Scope*, clang::Declarator&,
clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&,
llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&) + 17625
7 clang 0x0000000000b3b3a3
clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&,
llvm::MutableArrayRef<clang::TemplateParameterList*>) + 1811
8 clang 0x0000000000b3babb
clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&) + 43
9 clang 0x0000000000a01bf7
clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&,
clang::Parser::ParsedTemplateInfo const&) + 87
10 clang 0x0000000000a11b6f
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 2191
11 clang 0x0000000000a1576a
clang::Parser::ParseSimpleDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&,
unsigned int, clang::SourceLocation&,
clang::Parser::ParsedAttributesWithRange&, bool, clang::Parser::ForRangeInit*)
+ 778
12 clang 0x0000000000a15a2a
clang::Parser::ParseDeclaration(llvm::SmallVector<clang::Stmt*, 32u>&, unsigned
int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 218
13 clang 0x0000000000a5b718
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 328
14 clang 0x0000000000a5bebe
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 142
15 clang 0x0000000000a5cf35
clang::Parser::ParseCompoundStatementBody(bool) + 1829
16 clang 0x0000000000a5d420
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 224
17 clang 0x00000000009fc36c
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
2620
18 clang 0x0000000000a11ad1
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 2033
19 clang 0x00000000009f5cc9
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 249
20 clang 0x00000000009f7ebe
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 1022
21 clang 0x00000000009f94ae
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 78
22 clang 0x00000000009f9f30
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 192
23 clang 0x00000000009f30b0 clang::ParseAST(clang::Sema&, bool, bool)
+ 288
24 clang 0x00000000008527ee clang::CodeGenAction::ExecuteAction() +
78
25 clang 0x00000000006ca1f9 clang::FrontendAction::Execute() + 313
26 clang 0x00000000006ac0c5
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 341
27 clang 0x000000000068d297
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1527
28 clang 0x0000000000682dc8 cc1_main(char const**, char const**, char
const*, void*) + 1240
29 clang 0x000000000068aef8 main + 7560
30 libc.so.6 0x0000003fef81ecdd __libc_start_main + 253
31 clang 0x0000000000682709
Stack dump:
0. Program arguments: /home/erbacc/clang/bld/Release+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 -resource-dir
/home/erbacc/clang/bld/Release+Asserts/bin/../lib/clang/3.3 -internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/x86_64-redhat-linux
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/backward
-internal-isystem
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/x86_64-redhat-linux/c++/4.4.6
-internal-isystem /usr/local/include -internal-isystem
/home/erbacc/clang/bld/Release+Asserts/bin/../lib/clang/3.3/include
-internal-externc-isystem /include -internal-externc-isystem /usr/include -Wall
-Wextra --std=c++11 -fdeprecated-macro -fdebug-compilation-dir
/home/erbacc/clang/bld/Release+Asserts/bin -ferror-limit 19 -fmessage-length
157 -mstackrealign -fobjc-runtime=gcc -fobjc-default-synthesize-properties
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -fcolor-diagnostics
-backend-option -vectorize-loops -o /usr/tmp/test-0HQ6ww.o -x c++ test.cpp
1. test.cpp:5:35: current parser token ';'
2. test.cpp:2:1: parsing function body 'main'
3. test.cpp:2:1: in compound statement ('{}')
clang: error: unable to execute command: Aborted
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.3 (tags/RELEASE_33/final)
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: /usr/tmp/test-AsAoDp.cpp
clang: note: diagnostic msg: /usr/tmp/test-AsAoDp.sh
clang: note: diagnostic msg:
********************
/usr/tmp/test-AsAoDp.sh is
/home/x/clang/bld/Release+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 -Wall -Wextra --std=c++11 -fdeprecated-macro -ferror-limit 19
-fmessage-length 157 -mstackrealign -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops
-x c++ test-AsAoDp.cpp</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>