public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/98367] New: ICE with CTAD non-type template parameter
@ 2020-12-18  3:38 jbassett271 at gmail dot com
  2020-12-18  3:40 ` [Bug c++/98367] " jbassett271 at gmail dot com
  2020-12-18 15:04 ` mpolacek at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: jbassett271 at gmail dot com @ 2020-12-18  3:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98367
           Summary: ICE with CTAD non-type template parameter
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jbassett271 at gmail dot com
  Target Milestone: ---

This ICEs the compiler with a segfault (see https://godbolt.org/z/ddceoM ):

template <typename A>
struct ctad_t {
    A a;
};

template <ctad_t T>
struct myclass {
};

template <typename Something>
constexpr auto myobject = ctad_t {Something::value};

template <typename Something>
using thing = myclass<myobject<Something>>;


Compiled with (grabbed from the Compiler Explorer link): g++ -g -o output.s
-masm=intel -S -fdiagnostics-color=always -std=c++2a example.cpp

I have also confirmed this on my own machine with gcc version 10.1.0.

Tested with GCC versions on Compiler Explorer:
 - gcc version 11.0.0 20201216 (experimental)
 - gcc version 10.2.0
 - gcc version 10.1.0
 - gcc version 9.3.0
 - gcc version 9.2.0
 - gcc version 9.1.0
 - gcc version 8.3.0
 - gcc version 8.2.0
 - gcc version 8.1.0

These also segfaulted with -std=c++1z instead of -std=c++2a:
 - gcc version 7.5.0
 - gcc version 7.4.0
 - gcc version 7.3.0
 - gcc version 7.2.0
 - gcc version 7.1.0

Earlier versions did not support CTAD.

Inlining the `object` variable does not segfault, but emits a message about
being unable to perform CTAD: https://godbolt.org/z/drWT6h

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

* [Bug c++/98367] ICE with CTAD non-type template parameter
  2020-12-18  3:38 [Bug c++/98367] New: ICE with CTAD non-type template parameter jbassett271 at gmail dot com
@ 2020-12-18  3:40 ` jbassett271 at gmail dot com
  2020-12-18 15:04 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: jbassett271 at gmail dot com @ 2020-12-18  3:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Justin Bassett <jbassett271 at gmail dot com> ---
It also ICEs with a segfault even if the `myobject` doesn't do CTAD itself but
has its type explicitly specified: https://godbolt.org/z/Mjfe6c .

Inlining the non-CTAD version does not ICE, though:
https://godbolt.org/z/M8x7sY

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

* [Bug c++/98367] ICE with CTAD non-type template parameter
  2020-12-18  3:38 [Bug c++/98367] New: ICE with CTAD non-type template parameter jbassett271 at gmail dot com
  2020-12-18  3:40 ` [Bug c++/98367] " jbassett271 at gmail dot com
@ 2020-12-18 15:04 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-12-18 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Dup, I think.  This is a nice test, though.

*** This bug has been marked as a duplicate of bug 93383 ***

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

end of thread, other threads:[~2020-12-18 15:04 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-18  3:38 [Bug c++/98367] New: ICE with CTAD non-type template parameter jbassett271 at gmail dot com
2020-12-18  3:40 ` [Bug c++/98367] " jbassett271 at gmail dot com
2020-12-18 15:04 ` 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).