[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Segfault on compiling template defined in wrong namespace.



>Submitter-Id:	net
>Originator:	
>Organization:	Google, Inc.
>Confidential:	no
>Synopsis:	Segfault on compiling template defined in wrong namespace.
>Severity:	non-critical
>Priority:	low
>Category:	c++
>Class:		ice-on-illegal-code
>Release:	4.0.3 (Ubuntu 4.0.3-1ubuntu5) (Debian testing/unstable)
>Environment:
System: Linux temporal.corp.google.com 2.6.18.5-gg34workstation-mixed64-32 #1 SMP Thu May 8 01:31:23 UTC 2008 x86_64 GNU/Linux
Architecture: x86_64

host: i486-pc-linux-gnu
build: i486-pc-linux-gnu
target: i486-pc-linux-gnu
configured with: ../src/configure -v --enable-languages=c,c++,java,f95,objc,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.0 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk-default --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.0-1.4.2.0/jre --enable-mpfr --disable-werror --with-tune=pentium4 --enable-checking=release i486-linux-gnu
>Description:
G++ reports a segmentation fault when compiling the code below.
>How-To-Repeat:
Invoke g++ on the following (invalid) code with no other arguments.
There are no #includes; this is the entire source file.

======================
namespace a {
  template <typename T> class Foo;
}

namespace b {
  template <> class ::a::Foo<double> {};
}
======================

(The gccbug script claims it will remove "comments" delimited by angle brackets.
Hopefully that isn't actually true because it will mess up the above code
sample as well as the following error log.)

Result:
testtemplate.cc:6: error: global qualification of class name is invalid before '{' token
testtemplate.cc:6: error: specialization of 'template<class T> struct a::Foo' in different namespace
testtemplate.cc:2: error:   from definition of 'template<class T> struct a::Foo'
g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
For Debian GNU/Linux specific bug reporting instructions, see
<URL:file:///usr/share/doc/gcc-4.0/README.Bugs>.
>Fix:
Unknown.


Reply to: