The following piece of code:

=====================================================
#include <string>

const std::string space(" ");

template<const std::string& Str = space>
void f()
{
}

int main()
{
    f<>();
}
=====================================================


leads to a compiler internal error:
=====================================================
$ g++ -std=c++0x main.cpp space.cpp
main.cpp: In function 'int main()':
main.cpp:3: internal compiler error: Segmentation fault
=====================================================


This bug occurs with any reference template parameter (i.e. not only
std::string&).



I hope my reports are helpful :)

$ g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc/configure --enable-languages='c c++' --disable-nls :
(reconfigured) ../gcc/configure --enable-languages='c c++' : (reconfigured)
../gcc/configure --enable-languages='c c++' --enable-shared --disable-static
--disable-nls
Thread model: posix
gcc version 4.4.0 20081005 (experimental) (GCC)


-- 
           Summary: [C++0x] ICE with function's default reference template
                    parameter
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: florian dot goujeon at wanadoo dot fr
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to