public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114066] New: Allow classes with constructors in anonymous struct
@ 2024-02-22 22:07 redorav at gmail dot com
2024-02-22 22:11 ` [Bug c++/114066] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: redorav at gmail dot com @ 2024-02-22 22:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114066
Bug ID: 114066
Summary: Allow classes with constructors in anonymous struct
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redorav at gmail dot com
Target Milestone: ---
Hi,
I am aware that the standard does not mandate allowing members with
constructors in anonymous structs and in this case GCC does not support it, but
I would like to request the feature. I am also aware of 86001 which looks
similar (but is a question) and 77314, which requests support for POD types.
However I'm looking for the full thing.
My use case is a math library, hlsl++, where in AVX mode I alias a single m256
with two m128 members. This is so that I can support matrix swizzles. The
internal structure of float4x4 looks conceptually like this (simplified):
template<int X, int Y, int Z, int W>
struct swizzle4
{
swizzle& operator = (const swizzle& other) // Do swizzle things
m128 s;
};
float4x4
{
union
{
m256 vec;
struct
{
swizzle4<0, 1, 2, 3> _m00_m10_m20_m30;
swizzle4<0, 1, 2, 3> _m01_m11_m21_m31;
};
};
};
The swizzles are meant to be able to manipulate the data via rows (e.g. setting
a transformation matrix). If there is a better way to do this I don't really
know how, and so far this has been succesful in other compilers and seems like
a nice way to do it. If it was possible to support it in the same way unions
support it it'd be a nice addition.
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/114066] Allow classes with constructors in anonymous struct
2024-02-22 22:07 [Bug c++/114066] New: Allow classes with constructors in anonymous struct redorav at gmail dot com
@ 2024-02-22 22:11 ` pinskia at gcc dot gnu.org
2024-02-22 22:13 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-22 22:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114066
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |enhancement
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/114066] Allow classes with constructors in anonymous struct
2024-02-22 22:07 [Bug c++/114066] New: Allow classes with constructors in anonymous struct redorav at gmail dot com
2024-02-22 22:11 ` [Bug c++/114066] " pinskia at gcc dot gnu.org
@ 2024-02-22 22:13 ` pinskia at gcc dot gnu.org
2024-02-22 22:14 ` pinskia at gcc dot gnu.org
2024-02-22 22:24 ` redorav at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-22 22:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114066
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Simplified/corrected testcase:
```
struct swizzle4
{
swizzle4& operator = (const swizzle4& other);
};
struct
float4x4
{
struct {
swizzle4 _m00_m10_m20_m30;
};
};
```
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/114066] Allow classes with constructors in anonymous struct
2024-02-22 22:07 [Bug c++/114066] New: Allow classes with constructors in anonymous struct redorav at gmail dot com
2024-02-22 22:11 ` [Bug c++/114066] " pinskia at gcc dot gnu.org
2024-02-22 22:13 ` pinskia at gcc dot gnu.org
@ 2024-02-22 22:14 ` pinskia at gcc dot gnu.org
2024-02-22 22:24 ` redorav at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-02-22 22:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114066
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>anonymous structs
Which are a GNU extension to begin with ...
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/114066] Allow classes with constructors in anonymous struct
2024-02-22 22:07 [Bug c++/114066] New: Allow classes with constructors in anonymous struct redorav at gmail dot com
` (2 preceding siblings ...)
2024-02-22 22:14 ` pinskia at gcc dot gnu.org
@ 2024-02-22 22:24 ` redorav at gmail dot com
3 siblings, 0 replies; 5+ messages in thread
From: redorav at gmail dot com @ 2024-02-22 22:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114066
--- Comment #3 from Emilio López <redorav at gmail dot com> ---
Hi Andrew,
Thanks for the fast reply, I understand that some things are outside the spec,
but it'd be a great addition, if possible. The simplified test case you made
would definitely repro the error message I get, I was just trying to illustrate
the real use case it would be useful for.
Thanks
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-02-22 22:24 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-22 22:07 [Bug c++/114066] New: Allow classes with constructors in anonymous struct redorav at gmail dot com
2024-02-22 22:11 ` [Bug c++/114066] " pinskia at gcc dot gnu.org
2024-02-22 22:13 ` pinskia at gcc dot gnu.org
2024-02-22 22:14 ` pinskia at gcc dot gnu.org
2024-02-22 22:24 ` redorav at gmail dot com
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).