public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109095] New: ICE when specializing a template with an auto nontype template template parameter
@ 2023-03-10 20:55 n.morales.0 at proton dot me
  2023-03-10 22:21 ` [Bug c++/109095] " pinskia at gcc dot gnu.org
  2023-03-13 15:19 ` mpolacek at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: n.morales.0 at proton dot me @ 2023-03-10 20:55 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109095
           Summary: ICE when specializing a template with an auto nontype
                    template template parameter
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: n.morales.0 at proton dot me
  Target Milestone: ---

This ICE is present in gcc 12.1/2 and in trunk:

template< typename T >
struct bar
{};

template< int X >
struct baz
{};

template< auto N, template< auto N2 > typename TT >
struct foo;

template< typename T, bar< T > B, template< T N2 > typename TT >
struct foo< B, TT >
{};

foo< bar< int >{}, baz > x;


This code ICE's with the following message when compiled with
-std=c++20 -Werror -Wall -Wextra

<source>:13:19: internal compiler error: in tsubst, at cp/pt.cc:15867
   13 | struct foo< B, TT >
      |                   ^
0x1bb069e internal_error(char const*, ...)
        ???:0
0x6ff396 fancy_abort(char const*, int, char const*)
        ???:0
0x884007 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ???:0
0x8aa461 finish_template_type(tree_node*, tree_node*, int)
        ???:0
0x861eaa c_parse_file()
        ???:0
0x93e4e5 c_common_parse_file()
        ???:0

I found a workaround to the ICE by making N2 "auto" instead of "T". Also, this
code compiles fine on clang 15.

Here is a godbolt link: https://godbolt.org/z/vxxeG36Gz

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

* [Bug c++/109095] ICE when specializing a template with an auto nontype template template parameter
  2023-03-10 20:55 [Bug c++/109095] New: ICE when specializing a template with an auto nontype template template parameter n.morales.0 at proton dot me
@ 2023-03-10 22:21 ` pinskia at gcc dot gnu.org
  2023-03-13 15:19 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-03-10 22:21 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-03-10
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

* [Bug c++/109095] ICE when specializing a template with an auto nontype template template parameter
  2023-03-10 20:55 [Bug c++/109095] New: ICE when specializing a template with an auto nontype template template parameter n.morales.0 at proton dot me
  2023-03-10 22:21 ` [Bug c++/109095] " pinskia at gcc dot gnu.org
@ 2023-03-13 15:19 ` mpolacek at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2023-03-13 15:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
We ICE in tsubst

            if (code == TEMPLATE_TYPE_PARM)
              {
                int quals;

                /* When building concept checks for the purpose of
                   deducing placeholders, we can end up with wildcards
                   where types are expected. Adjust this to the deduced
                   value.  */
                if (TREE_CODE (arg) == WILDCARD_DECL)
                  arg = TREE_TYPE (TREE_TYPE (arg));

                gcc_assert (TYPE_P (arg));

like a few other PRs.  So it could be a dup.

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

end of thread, other threads:[~2023-03-13 15:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-10 20:55 [Bug c++/109095] New: ICE when specializing a template with an auto nontype template template parameter n.morales.0 at proton dot me
2023-03-10 22:21 ` [Bug c++/109095] " pinskia at gcc dot gnu.org
2023-03-13 15:19 ` 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).