[LLVMbugs] [Bug 16531] New: ICE from 'main' cannot be a template

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 3 11:39:01 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16531

            Bug ID: 16531
           Summary: ICE from 'main' cannot be a template
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: slayoo at igf.fuw.edu.pl
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

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

********************

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130703/570c6a19/attachment.html>


More information about the llvm-bugs mailing list