I first encountered this problem with GCC 4.3.1. With that compiler, the
program compiles fine (without warnings) but crashes at runtime. I tried a
recent snapshot of version 4.4 before submitting a bug report, and there an
internal compiler error is produced instead. So although this bug report is
filed for 4.4, a similar bug is present in at least 4.3.1 (and probably
others).

I don't really understand what causes the bug, so I'll just give you the source
code for a (self-contained, simplified) test case that causes the internal
compiler error along with my output, and hope you are able to figure it out.
;-)

$ g++ -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.4-20080704/configure
--prefix=/home/maks/gcc-4.4-20080704
Thread model: posix
gcc version 4.4.0 20080704 (experimental) (GCC)

$ g++ -c -Wall -Wextra bug.cpp
bug.cpp: In function ‘void invoke() [with C = Foo, void (C::* M)() =
method]’:
bug.cpp:9: internal compiler error: in expand_expr_real_1, at expr.c:7279
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.


-- 
           Summary: Internal compiler error with template/pointer to member
                    functions
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: maksverver at geocities dot com
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


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

Reply via email to