[Bug 520043] [NEW] g++ segfaults on templated class virtuals

Orbital_sFear orbital.sfear at gmail.com
Wed Feb 10 19:39:20 UTC 2010


Public bug reported:

Binary package hint: gcc-4.3

While trying to compile virtual methods of a templated class, I get an
internal compiler error: SegFault.

When you look at the code, specifically the virtual and child method,
there is clearly a logic issue.  That is my fault.  However,  users
shouldn't see a segfault; a syntax error would make more sense.

The follow code will reproduce the error.

template <typename T>
class Temp
{
  int Val;
  public:
  operator T&(void)  { return Val; }

  virtual T& operator=(T a )
  {
    Val = a;
    return Val;
  }
};

class Int : public Temp<int>
{
  public:
  Int& operator=(int a)
  {
    return (*this);
  }
};

int main() { return 1; }

  //Command line
g++ main.cpp

main.cpp:16: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.3/README.Bugs> for instructions.

  //G++ version
g++ -v

Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.3.3-5ubuntu4' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) 

  //lsb_release -rd
lsb_release -rd

Description:	Ubuntu 9.04
Release:	9.04

  //apt-cache policy
apt-cache policy

g++:
  Installed: 4:4.3.3-1ubuntu1
  Candidate: 4:4.3.3-1ubuntu1
  Version table:
 *** 4:4.3.3-1ubuntu1 0
        500 http://us.archive.ubuntu.com jaunty/main Packages
        100 /var/lib/dpkg/status

-Orby

** Affects: gcc-4.3 (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: g++ segfault template virtual

-- 
g++ segfaults on templated class virtuals
https://bugs.launchpad.net/bugs/520043
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list