public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/113263] New: ICE for invalid code for compound literal and type definition in return type
@ 2024-01-08 7:35 muecker at gwdg dot de
2024-01-08 7:43 ` [Bug c++/113263] " pinskia at gcc dot gnu.org
2024-01-08 7:48 ` pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: muecker at gwdg dot de @ 2024-01-08 7:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113263
Bug ID: 113263
Summary: ICE for invalid code for compound literal and type
definition in return type
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: muecker at gwdg dot de
Target Milestone: ---
The following example ICEs after invalid code (it is valid C but not C++)
https://godbolt.org/z/7zrbxPraM
(partially minimized from: C example https://godbolt.org/z/M7n7o1r8h)
#define TOKEN_CONCAT_EX(x, y) x##y
#define TOKEN_CONCAT(x, y) TOKEN_CONCAT_EX(x, y)
#define UNIQUIFY(x) TOKEN_CONCAT(x, __LINE__)
#define ResultBody(T, E) { bool _is_ok; union { T _ok; E _err; }; }
#define ResultName(T, E) result_##T##_##E
#define ResultEx(T, E, T_N, E_N) struct ResultName(T_N, E_N) ResultBody(T, E)
#define Result(T, E) ResultEx(T, E, T, E)
#define Err(R, V) ((R) { ._is_ok = false, ._err = V, })
typedef struct
{
int val;
} thing_t;
Result(thing_t, bool) maybe_make_thing(int v)
{
return Err(Result(thing_t, bool), v == 200);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/113263] ICE for invalid code for compound literal and type definition in return type
2024-01-08 7:35 [Bug c++/113263] New: ICE for invalid code for compound literal and type definition in return type muecker at gwdg dot de
@ 2024-01-08 7:43 ` pinskia at gcc dot gnu.org
2024-01-08 7:48 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-08 7:43 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113263
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 57004
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=57004&action=edit
Preprocessed source
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/113263] ICE for invalid code for compound literal and type definition in return type
2024-01-08 7:35 [Bug c++/113263] New: ICE for invalid code for compound literal and type definition in return type muecker at gwdg dot de
2024-01-08 7:43 ` [Bug c++/113263] " pinskia at gcc dot gnu.org
@ 2024-01-08 7:48 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-01-08 7:48 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113263
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
Keywords| |ice-checking,
| |ice-on-invalid-code
Last reconfirmed| |2024-01-08
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It has nothing to do with the return type.
Rather it is just an initialization that is causing the issue with the type
defined there and an anonymous union.
Reduced testcase:
```
void
maybe_make_thing(void)
{
(struct { union { bool _err; }; })
{ ._err = 1, } ;
}
```
Confirmed, looks like it is only and ICE with checking too.
```
<source>: In function 'void maybe_make_thing()':
<source>:5:20: error: 'maybe_make_thing()::<unnamed union>::_err' is not a
direct member of 'maybe_make_thing()::<unnamed struct>'
5 | { ._err = 1, } ;
| ^
```
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-08 7:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-08 7:35 [Bug c++/113263] New: ICE for invalid code for compound literal and type definition in return type muecker at gwdg dot de
2024-01-08 7:43 ` [Bug c++/113263] " pinskia at gcc dot gnu.org
2024-01-08 7:48 ` 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).