public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94507] New: internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr
@ 2020-04-06 23:33 mpolacek at gcc dot gnu.org
  2020-04-06 23:34 ` [Bug c++/94507] [8/9/10 Regression] " mpolacek at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-06 23:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94507
           Summary: internal compiler error: tree check: expected
                    template_decl, have error_mark in tsubst_lambda_expr
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

struct S { };

template<typename T, typename U>
auto foo(T, U)
{
  [] <> () { foo (S{}, S{}); };
}

$ ./cc1plus -quiet -std=c++20 z.C
z.C: In function ‘auto foo(T, U)’:
z.C:6:7: error: expected identifier before ‘>’ token
    6 |   [] <> () { foo (S{}, S{}); };
      |       ^
z.C: In instantiation of ‘auto foo(T, U) [with T = S; U = S]’:
z.C:6:27:   required from here
z.C:6:3: note: invalid template non-type parameter
    6 |   [] <> () { foo (S{}, S{}); };
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
z.C:6:3: internal compiler error: tree check: expected template_decl, have
error_mark in tsubst_lambda_expr, at cp/pt.c:18880
0x19afd31 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /home/mpolacek/src/gcc/gcc/tree.c:9727
0x912e6b tree_check(tree_node*, char const*, int, char const*, tree_code)
        /home/mpolacek/src/gcc/gcc/tree.h:3279
0xbe40a1 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:18880
0xbeb2fb tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, bool,
bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:20321
0xbe2d59 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:18614
0xbdb83f tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:17727
0xbdb5d1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:17697
0xbde18e tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:18015
0xc01c32 instantiate_decl(tree_node*, bool, bool)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:25539
0xc025eb instantiate_pending_templates(int)
        /home/mpolacek/src/gcc/gcc/cp/pt.c:25655
0xa66864 c_parse_final_cleanups()
        /home/mpolacek/src/gcc/gcc/cp/decl2.c:4874
0xd45bae c_common_parse_file()
        /home/mpolacek/src/gcc/gcc/c-family/c-opts.c:1212
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug c++/94507] [8/9/10 Regression] internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr
  2020-04-06 23:33 [Bug c++/94507] New: internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr mpolacek at gcc dot gnu.org
@ 2020-04-06 23:34 ` mpolacek at gcc dot gnu.org
  2020-04-06 23:34 ` mpolacek at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-06 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|internal compiler error:    |[8/9/10 Regression]
                   |tree check: expected        |internal compiler error:
                   |template_decl, have         |tree check: expected
                   |error_mark in               |template_decl, have
                   |tsubst_lambda_expr          |error_mark in
                   |                            |tsubst_lambda_expr
           Priority|P3                          |P4
   Target Milestone|---                         |8.5
           Keywords|                            |error-recovery,
                   |                            |ice-on-invalid-code

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

* [Bug c++/94507] [8/9/10 Regression] internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr
  2020-04-06 23:33 [Bug c++/94507] New: internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr mpolacek at gcc dot gnu.org
  2020-04-06 23:34 ` [Bug c++/94507] [8/9/10 Regression] " mpolacek at gcc dot gnu.org
@ 2020-04-06 23:34 ` mpolacek at gcc dot gnu.org
  2020-04-06 23:43 ` mpolacek at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-06 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r8-2720-gf44a8dd56f5bfbd0596c39693e268ef880c06221

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

* [Bug c++/94507] [8/9/10 Regression] internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr
  2020-04-06 23:33 [Bug c++/94507] New: internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr mpolacek at gcc dot gnu.org
  2020-04-06 23:34 ` [Bug c++/94507] [8/9/10 Regression] " mpolacek at gcc dot gnu.org
  2020-04-06 23:34 ` mpolacek at gcc dot gnu.org
@ 2020-04-06 23:43 ` mpolacek at gcc dot gnu.org
  2020-04-07  6:30 ` marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-06 23:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Candidate fix:

--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -18876,6 +18877,11 @@ tsubst_lambda_expr (tree t, tree args, tsubst_flags_t
complain, tree in_decl)
       if (oldtmpl)
    {
      tmpl = tsubst_template_decl (oldtmpl, args, complain, fntype);
+     if (tmpl == error_mark_node)
+       {
+         r = error_mark_node;
+         goto out;
+       }
      fn = DECL_TEMPLATE_RESULT (tmpl);
      finish_member_declaration (tmpl);
    }
@@ -18948,6 +18954,7 @@ tsubst_lambda_expr (tree t, tree args, tsubst_flags_t
complain, tree in_decl)
       maybe_add_lambda_conv_op (type);
     }

+out:
   finish_struct (type, /*attr*/NULL_TREE);

   insert_pending_capture_proxies ();

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

* [Bug c++/94507] [8/9/10 Regression] internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr
  2020-04-06 23:33 [Bug c++/94507] New: internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr mpolacek at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-04-06 23:43 ` mpolacek at gcc dot gnu.org
@ 2020-04-07  6:30 ` marxin at gcc dot gnu.org
  2020-04-07 15:02 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-07  6:30 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2020-04-07
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

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

* [Bug c++/94507] [8/9/10 Regression] internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr
  2020-04-06 23:33 [Bug c++/94507] New: internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr mpolacek at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-04-07  6:30 ` marxin at gcc dot gnu.org
@ 2020-04-07 15:02 ` mpolacek at gcc dot gnu.org
  2020-04-08 17:44 ` cvs-commit at gcc dot gnu.org
  2020-04-08 17:46 ` [Bug c++/94507] [8/9 " mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-07 15:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
           Keywords|                            |patch

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I posted a patch:
https://gcc.gnu.org/pipermail/gcc-patches/2020-April/543391.html

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

* [Bug c++/94507] [8/9/10 Regression] internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr
  2020-04-06 23:33 [Bug c++/94507] New: internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr mpolacek at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-04-07 15:02 ` mpolacek at gcc dot gnu.org
@ 2020-04-08 17:44 ` cvs-commit at gcc dot gnu.org
  2020-04-08 17:46 ` [Bug c++/94507] [8/9 " mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-08 17:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:77d6dfc929832a542a25fc455b90f1a4bc83229c

commit r10-7636-g77d6dfc929832a542a25fc455b90f1a4bc83229c
Author: Marek Polacek <polacek@redhat.com>
Date:   Mon Apr 6 19:59:04 2020 -0400

    c++: Fix ICE-on-invalid with lambda template [PR94507]

    While reducing something else I noticed that we ICE on the following
    invalid code.  In tsubst_lambda_expr, tsubst_template_decl has already
    reported an error and returned the error_mark_node, so make sure we
    don't ICE on that.  I'm using a goto here because we still have to
    do finish_struct because it does popclass ().

            PR c++/94507 - ICE-on-invalid with lambda template.
            * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
            tsubst_function_decl returns error_mark_node.

            * g++.dg/cpp2a/lambda-generic7.C: New test.

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

* [Bug c++/94507] [8/9 Regression] internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr
  2020-04-06 23:33 [Bug c++/94507] New: internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr mpolacek at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-04-08 17:44 ` cvs-commit at gcc dot gnu.org
@ 2020-04-08 17:46 ` mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-04-08 17:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[8/9/10 Regression]         |[8/9 Regression] internal
                   |internal compiler error:    |compiler error: tree check:
                   |tree check: expected        |expected template_decl,
                   |template_decl, have         |have error_mark in
                   |error_mark in               |tsubst_lambda_expr
                   |tsubst_lambda_expr          |
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2020-04-08 17:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-06 23:33 [Bug c++/94507] New: internal compiler error: tree check: expected template_decl, have error_mark in tsubst_lambda_expr mpolacek at gcc dot gnu.org
2020-04-06 23:34 ` [Bug c++/94507] [8/9/10 Regression] " mpolacek at gcc dot gnu.org
2020-04-06 23:34 ` mpolacek at gcc dot gnu.org
2020-04-06 23:43 ` mpolacek at gcc dot gnu.org
2020-04-07  6:30 ` marxin at gcc dot gnu.org
2020-04-07 15:02 ` mpolacek at gcc dot gnu.org
2020-04-08 17:44 ` cvs-commit at gcc dot gnu.org
2020-04-08 17:46 ` [Bug c++/94507] [8/9 " 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).