public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95629] New: consteval operator== crashes compiler
@ 2020-06-10 21:38 tobias.bruell at gmail dot com
2020-06-10 22:52 ` [Bug c++/95629] " mpolacek at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: tobias.bruell at gmail dot com @ 2020-06-10 21:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95629
Bug ID: 95629
Summary: consteval operator== crashes compiler
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: tobias.bruell at gmail dot com
Target Milestone: ---
This also crashed in g++10 v10.1.0 for me.
#include <type_traits>
template<typename T>
struct hana {
template<typename U>
consteval bool operator==(hana<U>) {
return std::is_same_v<T, U>;
}
};
int main ()
{
static_assert(hana<int>{} == hana<int>{});
}
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/95629] consteval operator== crashes compiler
2020-06-10 21:38 [Bug c++/95629] New: consteval operator== crashes compiler tobias.bruell at gmail dot com
@ 2020-06-10 22:52 ` mpolacek at gcc dot gnu.org
2020-06-10 22:57 ` iains at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-10 22:52 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95629
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
Keywords| |ice-on-valid-code
Status|UNCONFIRMED |NEW
Last reconfirmed| |2020-06-10
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thanks for the report.
95629.C: In function ‘int main()’:
95629.C:13:42: internal compiler error: in extract_call_expr, at cp/call.c:6634
13 | static_assert(hana<int>{} == hana<int>{});
| ^
0x93ae4c extract_call_expr(tree_node*)
/home/mpolacek/src/gcc/gcc/cp/call.c:6634
0x939f5a build_new_op_1
/home/mpolacek/src/gcc/gcc/cp/call.c:6335
0x93abb8 build_new_op(op_location_t const&, tree_code, int, tree_node*,
tree_node*, tree_node*, tree_node**, int)
/home/mpolacek/src/gcc/gcc/cp/call.c:6592
0xcb24b5 build_x_binary_op(op_location_t const&, tree_code, tree_node*,
tree_code, tree_node*, tree_code, tree_node**, int)
/home/mpolacek/src/gcc/gcc/cp/typeck.c:4280
0xb42759 cp_parser_binary_expression
/home/mpolacek/src/gcc/gcc/cp/parser.c:9777
0xb42c12 cp_parser_assignment_expression
/home/mpolacek/src/gcc/gcc/cp/parser.c:9914
0xb43462 cp_parser_constant_expression
/home/mpolacek/src/gcc/gcc/cp/parser.c:10208
0xb4d16e cp_parser_static_assert
/home/mpolacek/src/gcc/gcc/cp/parser.c:14741
0xb4b0ff cp_parser_block_declaration
/home/mpolacek/src/gcc/gcc/cp/parser.c:13608
0xb4a594 cp_parser_declaration_statement
/home/mpolacek/src/gcc/gcc/cp/parser.c:13217
0xb4651c cp_parser_statement
/home/mpolacek/src/gcc/gcc/cp/parser.c:11523
0xb47230 cp_parser_statement_seq_opt
/home/mpolacek/src/gcc/gcc/cp/parser.c:11889
0xb47114 cp_parser_compound_statement
/home/mpolacek/src/gcc/gcc/cp/parser.c:11839
0xb5d175 cp_parser_function_body
/home/mpolacek/src/gcc/gcc/cp/parser.c:23115
0xb5d499 cp_parser_ctor_initializer_opt_and_function_body
/home/mpolacek/src/gcc/gcc/cp/parser.c:23166
0xb69008 cp_parser_function_definition_after_declarator
/home/mpolacek/src/gcc/gcc/cp/parser.c:29062
0xb68e2f cp_parser_function_definition_from_specifiers_and_declarator
/home/mpolacek/src/gcc/gcc/cp/parser.c:28978
0xb58384 cp_parser_init_declarator
/home/mpolacek/src/gcc/gcc/cp/parser.c:20721
0xb4b57c cp_parser_simple_declaration
/home/mpolacek/src/gcc/gcc/cp/parser.c:13785
0xb4b11e cp_parser_block_declaration
/home/mpolacek/src/gcc/gcc/cp/parser.c:13611
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/95629] consteval operator== crashes compiler
2020-06-10 21:38 [Bug c++/95629] New: consteval operator== crashes compiler tobias.bruell at gmail dot com
2020-06-10 22:52 ` [Bug c++/95629] " mpolacek at gcc dot gnu.org
@ 2020-06-10 22:57 ` iains at gcc dot gnu.org
2020-06-14 18:04 ` johelegp at gmail dot com
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: iains at gcc dot gnu.org @ 2020-06-10 22:57 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95629
--- Comment #2 from Iain Sandoe <iains at gcc dot gnu.org> ---
preliminary analysis on pr95510 (which might be a dup) has the assert failing
because the first operand of the target expression is a CTOR not a call.
However, accepting a CTOR there just leads to a fail later (that's as far as I
got).
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/95629] consteval operator== crashes compiler
2020-06-10 21:38 [Bug c++/95629] New: consteval operator== crashes compiler tobias.bruell at gmail dot com
2020-06-10 22:52 ` [Bug c++/95629] " mpolacek at gcc dot gnu.org
2020-06-10 22:57 ` iains at gcc dot gnu.org
@ 2020-06-14 18:04 ` johelegp at gmail dot com
2020-06-23 15:42 ` mpolacek at gcc dot gnu.org
2020-06-28 23:00 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2020-06-14 18:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95629
Johel Ernesto Guerrero Peña <johelegp at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |johelegp at gmail dot com
--- Comment #3 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Reduced test case: https://gcc.godbolt.org/z/aT8Dv-.
```C++
struct A { int x; };
consteval A operator+(A x) { return x; }
void f() { +A(0); }
```
This one doesn't involve a constructor call within the evaluation:
https://gcc.godbolt.org/z/fJQC_M.
```C++
struct A { int x; };
consteval const A& operator+(const A& x) { return x; }
void f() { constexpr A a(0); +a; }
```
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/95629] consteval operator== crashes compiler
2020-06-10 21:38 [Bug c++/95629] New: consteval operator== crashes compiler tobias.bruell at gmail dot com
` (2 preceding siblings ...)
2020-06-14 18:04 ` johelegp at gmail dot com
@ 2020-06-23 15:42 ` mpolacek at gcc dot gnu.org
2020-06-28 23:00 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-23 15:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95629
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed by r11-1455-g14c831f5ef614aabb6a8c85712fb166600e6cc05
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/95629] consteval operator== crashes compiler
2020-06-10 21:38 [Bug c++/95629] New: consteval operator== crashes compiler tobias.bruell at gmail dot com
` (3 preceding siblings ...)
2020-06-23 15:42 ` mpolacek at gcc dot gnu.org
@ 2020-06-28 23:00 ` mpolacek at gcc dot gnu.org
4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-06-28 23:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95629
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bence.kodaj at gmail dot com
--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
*** Bug 95951 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-06-28 23:00 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-10 21:38 [Bug c++/95629] New: consteval operator== crashes compiler tobias.bruell at gmail dot com
2020-06-10 22:52 ` [Bug c++/95629] " mpolacek at gcc dot gnu.org
2020-06-10 22:57 ` iains at gcc dot gnu.org
2020-06-14 18:04 ` johelegp at gmail dot com
2020-06-23 15:42 ` mpolacek at gcc dot gnu.org
2020-06-28 23:00 ` 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).