[Bug c++/43647] New: "confused by earlier errors, bailing out" for member template explicit specialization

hovhannes_ter_meliqsetyan at yahoo dot com gcc-bugzilla@gcc.gnu.org
Mon Apr 5 12:22:00 GMT 2010


Target: x86_64-linux-gnu

Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.4.1-4ubuntu9'
--with-bugurl=file:///usr/share/doc/gcc-4.4/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--enable-multiarch --enable-linker-build-id --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.4 --program-suffix=-4.4 --enable-nls
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --disable-werror
--with-arch-32=i486 --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.4.1 (Ubuntu 4.4.1-4ubuntu9) 

GNU C++ (Ubuntu 4.4.1-4ubuntu9) version 4.4.1 (x86_64-linux-gnu)
        compiled by GNU C version 4.4.1, GMP version 4.3.1, MPFR version
2.4.1-p2.

g++ -Wall -v -save-temps src/main.cpp 

src/test.hpp:26: error: specialization of ‘template<class T> void N::X::F()’ in
different namespace
src/test.hpp:14: error:   from definition of ‘template<class T> void N::X::F()’
src/test.hpp:28: confused by earlier errors, bailing out
Preprocessed source stored into /tmp/cc7hr4I6.out file, please attach this to
your bugreport.



namespace N {
 struct X;
}

struct N::X
{
 template < typename T >
 void F();

 template < typename T1, typename T2 >
 struct G
 {};

 template < typename T2 >
 struct G < int, T2 >;

};

template <>
void N::X::F < int >()
{
 std::cout << "F specialization" << std::endl;
}

int main()
{
 N::X x;
 x.F< int >();
 return 0;
}

If I am not wrong, the explicit specialization of "F()" must be defined in
namespace scope, but why gcc "crushes" from this incorrect code ?

Thanks in advance.


-- 
           Summary: "confused by earlier errors, bailing out" for member
                    template explicit specialization
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hovhannes_ter_meliqsetyan at yahoo dot com


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



More information about the Gcc-bugs mailing list