[Bug c++/77967] New: trying to add a method to a template alias triggers an internal compiler error

kaelig.chatel at lixoft dot com gcc-bugzilla@gcc.gnu.org
Thu Oct 13 13:57:00 GMT 2016


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77967

            Bug ID: 77967
           Summary: trying to add a method to a template alias triggers an
                    internal compiler error
           Product: gcc
           Version: 5.4.0
            Status: UNCONFIRMED
          Severity: trivial
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kaelig.chatel at lixoft dot com
  Target Milestone: ---

Created attachment 39804
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=39804&action=edit
preprocessed source code raising the error

----------
Fixing the code will remove the problem. And the output still gives the
location of the error, if no real diagnosis as usual for an invalid code.

So, I think this is a trivial bug in its consequencies for users.
----------


The problem is that an "internal compiler error" is raised for the attached
code:

- first, a template alias is defined

- then, an erroneous code tries to define a method for this template alias as
if it was a template class  (in the first use case, it was previously a class,
and I forgot to clean this part of my code, raising the "internal compiler
error").


---------- command ------------------------

gcc -v -save-temps -std=c++11 method_on_alias_internal_error.cpp

--------- command outputs -----------------------

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
5.4.0-6ubuntu1~16.04.2' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs
--enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-5 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-libmpx --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-5-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-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 --enable-multilib
--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 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.2) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-mtune=generic'
'-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -E -quiet -v -imultiarch
x86_64-linux-gnu -D_GNU_SOURCE method_on_alias_internal_error.cpp
-mtune=generic -march=x86-64 -std=c++11 -fpch-preprocess
-fstack-protector-strong -Wformat -Wformat-security -o
method_on_alias_internal_error.ii
ignoring duplicate directory "/usr/include/x86_64-linux-gnu/c++/5"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/5/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/include/c++/5
 /usr/include/x86_64-linux-gnu/c++/5
 /usr/include/c++/5/backward
 /usr/lib/gcc/x86_64-linux-gnu/5/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/5/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-std=c++11' '-mtune=generic'
'-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/5/cc1plus -fpreprocessed
method_on_alias_internal_error.ii -quiet -dumpbase
method_on_alias_internal_error.cpp -mtune=generic -march=x86-64 -auxbase
method_on_alias_internal_error -std=c++11 -version -fstack-protector-strong
-Wformat -Wformat-security -o method_on_alias_internal_error.s
GNU C++11 (Ubuntu 5.4.0-6ubuntu1~16.04.2) version 5.4.0 20160609
(x86_64-linux-gnu)
        compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR
version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C++11 (Ubuntu 5.4.0-6ubuntu1~16.04.2) version 5.4.0 20160609
(x86_64-linux-gnu)
        compiled by GNU C version 5.4.0 20160609, GMP version 6.1.0, MPFR
version 3.1.4, MPC version 1.0.3
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 15157934e8203caff79287fd8f2d2843
method_on_alias_internal_error.cpp:7:1: internal compiler error: in
cp_parser_type_name, at cp/parser.c:15248
 bar<T>::bar(const T& cr)
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.


More information about the Gcc-bugs mailing list