ICE on the following code (part of an emulation of C++0X nullptr).  I think the
code should fail to compile, but am not completely sure.

Error message:

C++ ../../../util/base/Test/testcrash.o
../../../util/base/Test/testcrash.C: In member function ‘nullptr_t::operator T
U::*() const [with T = T, U = U]’:
../../../util/base/Test/testcrash.C:21: internal compiler error: in
gen_type_die_with_usage, at dwarf2out.c:13635
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Compilation command:

/opt/Numerica_share/compilers/4.3.3/bin/c++ -c -ansi -pipe -fPIC
-ftemplate-depth-150 -Wno-long-long -Wall -Wno-parentheses -pedantic
-Woverloaded-virtual -Wredundant-decls -ggdb -O2 -ffast-math -march=pentium4
-msse2 -mfpmath=sse,387 -mmmx -malign-double -m32 -D_REENTRANT -D_THREAD_SAFE
-pthread  testcrash.C

Compiler info:

Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.3.3/configure
--prefix=/home/dgsteffen/dave/opt/compilers/.gcc-4.3.3-32 --enable-shared
--enable-threads=posix --enable-__cxa_atexit --disable-checking
--with-system-zlib
Thread model: posix
gcc version 4.3.3 (GCC)

Source code (testcrash.C)
#include <iostream>

const struct nullptr_t
{
  // convert to ordinary pointer
  template<class T> operator T*() const { return 0; }

  // convert to pointer-to-member
  template<class T, class U> operator T U::*() const { return 0; }

} nullptr = {};

template<class T, class U> inline
bool operator==(const nullptr_t lhs, T U::* rhs) { return rhs == 0; }

using namespace std;

int main()
{

  if ( nullptr == 0 )
    cout << "Works" << endl;
}


-- 
           Summary: ICE in gen_type_die_with_usage
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dgsteffen at numerica dot us


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

Reply via email to