Bug 79590 - ICE (internal compiler error) in nothrow_spec_p with generic lambda and `noexcept(noexcept(...))` expression
Summary: ICE (internal compiler error) in nothrow_spec_p with generic lambda and `noex...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 7.0.1
: P3 normal
Target Milestone: 7.0
Assignee: Not yet assigned to anyone
URL:
Keywords: c++-lambda, ice-on-valid-code
Depends on:
Blocks: lambdas
  Show dependency treegraph
 
Reported: 2017-02-18 16:06 UTC by Vittorio Romeo
Modified: 2022-03-11 00:32 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2017-02-20 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vittorio Romeo 2017-02-18 16:06:25 UTC
auto f = [](auto x) noexcept(noexcept(x)) { };

The code above produces the following ICE error message:
(On wandbox: http://melpon.org/wandbox/permlink/0RwjRIKwMiUFjsFU)

    prog.cc:1:45: internal compiler error: in nothrow_spec_p, at cp/except.c:1155
     auto f = [](auto x) noexcept(noexcept(x)) { };
                                                 ^
    0x668117 nothrow_spec_p(tree_node const*)
        ../../source/gcc/cp/except.c:1151
    0x6c8d7f maybe_add_lambda_conv_op(tree_node*)
        ../../source/gcc/cp/lambda.c:1096
    0x62d22a cp_parser_lambda_expression
        ../../source/gcc/cp/parser.c:9911
    0x62d22a cp_parser_primary_expression
        ../../source/gcc/cp/parser.c:4978
    0x633e87 cp_parser_postfix_expression
        ../../source/gcc/cp/parser.c:6776
    0x634b1d cp_parser_unary_expression
        ../../source/gcc/cp/parser.c:8124
    0x635883 cp_parser_cast_expression
        ../../source/gcc/cp/parser.c:8801
    0x635ff7 cp_parser_binary_expression
        ../../source/gcc/cp/parser.c:8902
    0x6366a4 cp_parser_assignment_expression
        ../../source/gcc/cp/parser.c:9189
    0x636a87 cp_parser_constant_expression
        ../../source/gcc/cp/parser.c:9459
    0x6376e4 cp_parser_initializer_clause
        ../../source/gcc/cp/parser.c:21586
    0x6384fb cp_parser_initializer
        ../../source/gcc/cp/parser.c:21526
    0x647972 cp_parser_init_declarator
        ../../source/gcc/cp/parser.c:19343
    0x6480dd cp_parser_simple_declaration
        ../../source/gcc/cp/parser.c:12794
    0x648cf5 cp_parser_block_declaration
        ../../source/gcc/cp/parser.c:12619
    0x627754 cp_parser_declaration
        ../../source/gcc/cp/parser.c:12517
    0x64d28b cp_parser_declaration_seq_opt
        ../../source/gcc/cp/parser.c:12393
    0x64d572 cp_parser_translation_unit
        ../../source/gcc/cp/parser.c:4366
    0x64d572 c_parse_file()
        ../../source/gcc/cp/parser.c:38420
    0x71b5c3 c_common_parse_file()
        ../../source/gcc/c-family/c-opts.c:1107
Comment 1 Martin Liška 2017-02-20 08:07:55 UTC
Confirmed, started with r241944.
Comment 2 Vittorio Romeo 2017-04-12 13:55:41 UTC
This is still present. Here are some more examples:



int main()
{
    [](auto x) noexcept(noexcept(x)) { } (0);
}

<source>:3:40: internal compiler error: in nothrow_spec_p, at cp/except.c:1159
     [](auto x) noexcept(noexcept(x)) { } (0);
                                        ^



int main()
{
    [](auto) noexcept(noexcept(0)) { } (0);
}

<source>: In function 'int main()':
<source>:3:38: internal compiler error: in nothrow_spec_p, at cp/except.c:1159
     [](auto) noexcept(noexcept(0)) { } (0);
                                      ^
Comment 3 Jakub Jelinek 2017-05-02 15:57:09 UTC
GCC 7.1 has been released.
Comment 4 paolo@gcc.gnu.org 2017-10-02 22:02:34 UTC
Author: paolo
Date: Mon Oct  2 22:02:03 2017
New Revision: 253369

URL: https://gcc.gnu.org/viewcvs?rev=253369&root=gcc&view=rev
Log:
2017-10-02  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/79590
	* g++.dg/cpp1y/lambda-generic-noexcept1.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp1y/lambda-generic-noexcept1.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 5 Paolo Carlini 2017-10-02 22:03:41 UTC
The released 7.1.0 is fine. I added the testcases, to be safe.