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

            Bug ID: 59052
           Summary: Partial specialization of template with dependent
                    non-type template argument not correctly resolved
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: decaluwe.t at gmail dot com

Created attachment 31183
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31183&action=edit
The preprocessed code

This bug seems to be related to bug 59044
(http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59044).

The following code when compiled with 'g++ spec.cpp' is rejected by gcc 4.8.1:

/* ---- spec.cpp ---------------------------------------- */
namespace N {

template <class T>
struct C {
    template <class U, T t>
    struct Implementation {};
};

template <class T>
template <T t>
struct C<T>::Implementation<void, t> {
    static void method() {}
};

}

int main() {
    N::C<int>::Implementation<void, 0>::method();
}
/* ---------------------------------------------------- */

The bug is only triggered when the second template argument is a non-type
template argument dependent on the template argument of the enclosing class
template. The error message produced by g++ 4.8.1 (as found in the g++-4.8
package in the Ubuntu 13.10 repo, see below for build information):

spec.cpp: In function ‘int main()’:
spec.cpp:18:5: error: ‘method’ is not a member of
‘N::C<int>::Implementation<void, 0>’
     N::C<int>::Implementation<void, 0>::method();
     ^

This bug is still present in the gcc-snapshot package. However the code
compiles fine in g++ 4.7.3 (as found in the g++-4.7 package).

Additional information:

GCC version: gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu8) 
System type: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.8.1-10ubuntu8' --with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu

Reply via email to