public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96474] New: Internal compiler error with template struct inside template struct
@ 2020-08-04 23:35 lhlaurini at hotmail dot com
  2020-08-05 12:38 ` [Bug c++/96474] " mpolacek at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: lhlaurini at hotmail dot com @ 2020-08-04 23:35 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96474
           Summary: Internal compiler error with template struct inside
                    template struct
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lhlaurini at hotmail dot com
  Target Milestone: ---

Tested on Arch Linux (10.1.0) and on the online compiler godbolt.org (10.1.0,
10.2.0 and trunk), all with the same results. The following code (compile with
"g++ test.cpp -std=c++17"):

    template <typename T>
    struct A
    {
        template <typename U = T>
        struct B
        {
            //B() {}
        };
    };

    A<int>::B x;

outputs:

    <source>: In substitution of 'template<class U> B()-> A<int>::B<U> [with U
= int]':
    <source>:11:11:   required from here
    <source>:5:12: internal compiler error: in retrieve_specialization, at
cp/pt.c:1240
        5 |     struct B
          |            ^
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <https://gcc.gnu.org/bugs/> for instructions.


Uncommenting "B() {}", it compiles fine (doesn't link, of course). Bug is not
present on 9.3 (also tested on godbolt.org).

---

Godbolt.org with "x86-64 gcc 9.3":

Target: x86_64-linux-gnu

Configured with: ../gcc-9.3.0/configure
--prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap
--enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --enable-clocale=gnu
--enable-languages=c,c++,fortran,ada,go,d --enable-ld=yes --enable-gold=yes
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id
--enable-lto --enable-plugins --enable-threads=posix
--with-pkgversion=Compiler-Explorer-Build

Thread model: posix

gcc version 9.3.0 (Compiler-Explorer-Build) 

---

Godbolt.org with "x86-64 gcc 10.2":

Target: x86_64-linux-gnu

Configured with: ../gcc-10.2.0/configure
--prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap
--enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --enable-clocale=gnu
--enable-languages=c,c++,fortran,ada,go,d --enable-ld=yes --enable-gold=yes
--enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-linker-build-id
--enable-lto --enable-plugins --enable-threads=posix
--with-pkgversion=Compiler-Explorer-Build

Thread model: posix

Supported LTO compression algorithms: zlib

gcc version 10.2.0 (Compiler-Explorer-Build)

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-03-03 20:14 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-04 23:35 [Bug c++/96474] New: Internal compiler error with template struct inside template struct lhlaurini at hotmail dot com
2020-08-05 12:38 ` [Bug c++/96474] " mpolacek at gcc dot gnu.org
2020-08-05 13:55 ` lhlaurini at hotmail dot com
2021-02-11 22:13 ` soko.slav at yandex dot ru
2021-03-03 20:04 ` mpolacek at gcc dot gnu.org
2021-03-03 20:13 ` cvs-commit at gcc dot gnu.org
2021-03-03 20:14 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).