<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 --- - ICE from 'main' cannot be a template"
href="http://llvm.org/bugs/show_bug.cgi?id=16531">16531</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>ICE from 'main' cannot be a template
</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>C++
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>slayoo@igf.fuw.edu.pl
</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>Hello,
Steps to reproduce the ICE below.
HTH,
Sylwester
$ cat bug.cpp
template <class T>
int main() { }
int main() { }
$ clang++ bug.cpp
bug.cpp:2:5: error: 'main' cannot be a template
int main() { }
^
0 libLLVM-3.3.so.1 0x00007f52eb5d4252 llvm::sys::PrintStackTrace(_IO_FILE*) +
34
1 libLLVM-3.3.so.1 0x00007f52eb5d40b9
2 libpthread.so.0 0x00007f52ea58b210
3 clang 0x0000000000a04b51
clang::Sema::CheckFunctionDeclaration(clang::Scope*, clang::FunctionDecl*,
clang::LookupResult&, bool) + 2593
4 clang 0x0000000000a10467
clang::Sema::ActOnFunctionDeclarator(clang::Scope*, clang::Declarator&,
clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&,
llvm::MutableArrayRef<clang::TemplateParameterList*>, bool&) + 12631
5 clang 0x0000000000a11631
clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&,
llvm::MutableArrayRef<clang::TemplateParameterList*>) + 1649
6 clang 0x0000000000a144ec
clang::Sema::ActOnStartOfFunctionDef(clang::Scope*, clang::Declarator&) + 44
7 clang 0x00000000008ebf47
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
3511
8 clang 0x00000000008fdf3a
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1562
9 clang 0x00000000008e59ed
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 237
10 clang 0x00000000008e61de
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 926
11 clang 0x00000000008e9799
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 249
12 clang 0x00000000008e9dc2
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 194
13 clang 0x00000000008e22db clang::ParseAST(clang::Sema&, bool,
bool) + 283
14 clang 0x00000000006522b9 clang::FrontendAction::Execute() + 169
15 clang 0x0000000000633cb2
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 290
16 clang 0x000000000061fb27
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1575
17 clang 0x000000000061af38 cc1_main(char const**, char const**,
char const*, void*) + 1160
18 clang 0x00000000006199c7 main + 7847
19 libc.so.6 0x00007f52e95c8a55 __libc_start_main + 245
20 clang 0x0000000000619f85
Stack dump:
0. Program arguments: /usr/bin/clang -cc1 -triple x86_64-pc-linux-gnu
-emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name
bug.cpp -mrelocation-model static -mdisable-fp-elim -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.23.52.20130612 -resource-dir /usr/bin/../lib/clang/3.3
-internal-isystem /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/x86_64-linux-gnu
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/c++/4.7/backward
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7
-internal-isystem /usr/local/include -internal-isystem
/usr/bin/../lib/clang/3.3/include -internal-isystem
/usr/include/clang/3.3/include/ -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /usr/include
-fdeprecated-macro -fdebug-compilation-dir /home/slayoo/Temp -ferror-limit 19
-fmessage-length 126 -mstackrealign -fobjc-runtime=gcc
-fobjc-default-synthesize-properties -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -backend-option -vectorize-loops
-o /tmp/bug-6RwZc4.o -x c++ bug.cpp
1. bug.cpp:4:12: current parser token '{'
clang: error: unable to execute command: Segmentation fault
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
Debian clang version 3.3-1 (branches/release_33) (based on LLVM 3.3)
Target: x86_64-pc-linux-gnu
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://bugs.debian.org/">http://bugs.debian.org/</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/bug-SgDTLv.cpp
clang: note: diagnostic msg: /tmp/bug-SgDTLv.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>