public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/111423] New: bogus Wsubobject-linkage when using CRTP with an invisible base, template template parameters, and concepts
@ 2023-09-15 8:06 brunopitrus at hotmail dot com
2023-09-15 14:17 ` [Bug c++/111423] " ppalka at gcc dot gnu.org
0 siblings, 1 reply; 2+ messages in thread
From: brunopitrus at hotmail dot com @ 2023-09-15 8:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111423
Bug ID: 111423
Summary: bogus Wsubobject-linkage when using CRTP with an
invisible base, template template parameters, and
concepts
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:
```
template <typename T>
concept bar = requires(const T& t) {
{ t.GetA() };
};
template <template<typename> typename T>
struct Derived : T<Derived<T>>{};
```
main.cpp:
```
#include "header.h"
namespace {
template<typename Derived>
struct Base2 {
void GetA() const {}
};
using B2 = Derived<Base2>;
static_assert(bar<B2>);
}
```
This code makes GCC complain with
```
In file included from /app/main.cpp:1:
header.h: In instantiation of 'struct Derived<{anonymous}::Base2>':
/app/header.h:3:7: required from here
/app/header.h:7:8: error: 'Derived<{anonymous}::Base2>' has a base
'{anonymous}::Base2<Derived<{anonymous}::Base2> >' which uses the anonymous
namespace [-Werror=subobject-linkage]
7 | struct Derived : T<Derived<T>>{};
| ^~~~~~~
```
which is incorrect — `Derived<{anonymous}::Base2>` should have internal linkage
due to it being dependent on the internal-linkage `{anonymous}::Base2` —
therefore it should not matter what linkage its bases have.
See it on Godbolt:
https://godbolt.org/z/q7jb5bGb6
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/111423] bogus Wsubobject-linkage when using CRTP with an invisible base, template template parameters, and concepts
2023-09-15 8:06 [Bug c++/111423] New: bogus Wsubobject-linkage when using CRTP with an invisible base, template template parameters, and concepts brunopitrus at hotmail dot com
@ 2023-09-15 14:17 ` ppalka at gcc dot gnu.org
0 siblings, 0 replies; 2+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-09-15 14:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111423
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
CC| |ppalka at gcc dot gnu.org
--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
dup of PR70413, I think
*** This bug has been marked as a duplicate of bug 70413 ***
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-09-15 14:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-15 8:06 [Bug c++/111423] New: bogus Wsubobject-linkage when using CRTP with an invisible base, template template parameters, and concepts brunopitrus at hotmail dot com
2023-09-15 14:17 ` [Bug c++/111423] " ppalka 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).