http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58080

            Bug ID: 58080
           Summary: internal compiler error, decltype in function
                    declaration (for SFINAE purposes)
           Product: gcc
           Version: 4.7.3
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nickolay.merkin at gmail dot com

Created attachment 30609
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30609&action=edit
preprocessed source code that leads to the ICE

Here is minimal example that reproduces the ICE:

g++ version 4.7.3 (Ubuntu/Linaro 4.7.3-2ubuntu1~12.04)
commandline: g++ std=c++11 x.cpp
(also crashes with std=gnu++11)

// /usr/lib/gcc/i686-linux-gnu/4.7/cc1plus -quiet -imultilib . -imultiarch
i386-linux-gnu -D_GNU_SOURCE x.cpp -quiet -dumpbase x.cpp -mtune=generic
-march=i686 -auxbase x -std=c++11 -fstack-protector -o - -frandom-seed=0
# 1 "x.cpp"
# 1 "<command-line>"
# 1 "x.cpp"
template<class A, class B>
struct Eval
{
 void foo(A a, B b) { bar(a,b, 0); }
 auto bar(A a, B b, decltype(a+b)* _) -> decltype(a+b) { return a+b; }
};

int main()
{
 Eval<int,void*> eiv; eiv.foo(0,0);
}

I intended to write a multimethod that does a+b for integral, pointer, string,
etc. types, -- and immediately met ICE.
Of course, operator+(void*,int) is not defined, but it is not a reason to
crash.
The compiler prepends the crash report with three warnings about VOID* in
arithmetic expression.

Reply via email to