public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114911] New: Anonymous unions can cause ICE when the name of their type escapes
@ 2024-05-01 18:41 pinskia at gcc dot gnu.org
2024-05-01 20:47 ` [Bug c++/114911] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-01 18:41 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114911
Bug ID: 114911
Summary: Anonymous unions can cause ICE when the name of their
type escapes
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Keywords: ice-checking, ice-on-valid-code
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: pinskia at gcc dot gnu.org
Target Milestone: ---
Take:
```
void g();
template<typename T>
struct Capture;
template<typename T>
struct Capture<T*> {
friend void g() {
&T::a;
}
};
struct X;
void f() {
union {
int a = sizeof(Capture<decltype(this)>);
};
g();
}
```
GCC ICEs with:
```
<source>: In instantiation of 'void g()':
<source>:19:6: required from here
19 | g();
| ~^~
<source>:9:9: internal compiler error: tree check: expected class 'type', have
'declaration' (function_decl) in build_offset_type, at tree.cc:7718
9 | &T::a;
| ^~~~~
0x267adac internal_error(char const*, ...)
???:0
0x966cd9 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
???:0
0xd20f91 build_x_unary_op(unsigned int, tree_code, cp_expr, tree_node*, int)
???:0
0xc95413 instantiate_decl(tree_node*, bool, bool)
???:0
0xcbeb3b instantiate_pending_templates(int)
???:0
0xb59819 c_parse_final_cleanups()
???:0
0xdb2668 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
```
Note this is the same testcase as the clang bug:
https://github.com/llvm/llvm-project/issues/90751 just that GCC ICEs too.
Note also this seems not to ICE with release checking .
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/114911] Anonymous unions can cause ICE when the name of their type escapes
2024-05-01 18:41 [Bug c++/114911] New: Anonymous unions can cause ICE when the name of their type escapes pinskia at gcc dot gnu.org
@ 2024-05-01 20:47 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-01 20:47 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114911
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to fail| |4.7.1
Keywords|ice-checking |
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Not changing `&T::a` to be a full definition:
int T::*b = &T::a;
or
auto b = &T::a;
Gives an ICE all the way back to GCC 4.7.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-05-01 20:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-01 18:41 [Bug c++/114911] New: Anonymous unions can cause ICE when the name of their type escapes pinskia at gcc dot gnu.org
2024-05-01 20:47 ` [Bug c++/114911] " pinskia 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).