This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53498] New: Compiler crashes during C++11 template magic compilation
- From: "o.mangold at googlemail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 27 May 2012 12:07:20 +0000
- Subject: [Bug c++/53498] New: Compiler crashes during C++11 template magic compilation
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53498
Bug #: 53498
Summary: Compiler crashes during C++11 template magic
compilation
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: o.mangold@googlemail.com
I was trying to create some template magic to create a check for the existence
of a function with variable number of arguments in C++11. Honestly, I don't
know, if my code should compile through, as the problem happened when I was
trying to figure out how to make it work. I got a compiler crash (which I guess
shouldn't happen in any case). I cooked it down to the example below:
> g++ -std=c++11 Crash.cxx
g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
kiwi/SafePrintf$g++ -std=c++11 Crash.cxx
g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.7/README.Bugs> for instructions.
---
--- Crash.cxx ---
template<typename... ARGS>
class A
{
public:
template<typename U>
auto a(const U& u,const ARGS&... args,int) -> decltype(u.print(args...))
{
}
template<typename U>
int a(const U& u,const ARGS&... args,...)
{
}
};
template<typename... ARGS>
class B
{
public:
template<typename U> static void
b(const U& u,const ARGS&... args,
decltype(A<ARGS...>::a(u,args...,0)) dummy)
{
}
};
int main() {
B<int> dummy;
return 0;
}