public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114267] New: bogus -Wsubobject-linkage when using lambda members as template parameters
@ 2024-03-07 13:22 brunopitrus at hotmail dot com
2024-03-07 17:42 ` [Bug c++/114267] " pinskia at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: brunopitrus at hotmail dot com @ 2024-03-07 13:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114267
Bug ID: 114267
Summary: bogus -Wsubobject-linkage when using lambda members as
template parameters
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: brunopitrus at hotmail dot com
Target Milestone: ---
header.h:
```
struct F{
constexpr static const auto algorithm=[]() {};
};
constexpr inline const auto algorithm=[]() {};
template<auto algo> struct G{};
struct S{
G<algorithm> foo; //ok
G<F::algorithm> lol; //Wsubobject-linkage
};
```
main.cpp:
//can be empty
See it on godbolt:
https://godbolt.org/z/qccjfTPnr
The behavior is inconsistent between the lambda declared as a member and as a
non-member. Moreover, if i compile this code with -O0, the resultant object has
a ‘r’ private symbol for F::algorithm, which makes me suspect that wrong code
is being generated.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/114267] bogus -Wsubobject-linkage when using lambda members as template parameters
2024-03-07 13:22 [Bug c++/114267] New: bogus -Wsubobject-linkage when using lambda members as template parameters brunopitrus at hotmail dot com
@ 2024-03-07 17:42 ` pinskia at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-03-07 17:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114267
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
struct F{
constexpr static const auto a=[]() {};
constexpr static const auto b=1.0;
};
auto t = F::a;
auto t0 = F::b;
```
t is localized while t0 is not.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-03-07 17:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-07 13:22 [Bug c++/114267] New: bogus -Wsubobject-linkage when using lambda members as template parameters brunopitrus at hotmail dot com
2024-03-07 17:42 ` [Bug c++/114267] " 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).