public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/90670] const& template parameter in a header trips -Wsubobject-linkage
       [not found] <bug-90670-4@http.gcc.gnu.org/bugzilla/>
@ 2022-06-20 10:35 ` Kitsune-Ral at users dot sf.net
  2023-09-15 16:51 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: Kitsune-Ral at users dot sf.net @ 2022-06-20 10:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90670

Alexey Rusakov <Kitsune-Ral at users dot sf.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Kitsune-Ral at users dot sf.net

--- Comment #1 from Alexey Rusakov <Kitsune-Ral at users dot sf.net> ---
Reproduced with GCC 12.1.1 on Fedora 36.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/90670] const& template parameter in a header trips -Wsubobject-linkage
       [not found] <bug-90670-4@http.gcc.gnu.org/bugzilla/>
  2022-06-20 10:35 ` [Bug c++/90670] const& template parameter in a header trips -Wsubobject-linkage Kitsune-Ral at users dot sf.net
@ 2023-09-15 16:51 ` ppalka at gcc dot gnu.org
  2023-09-16  2:02 ` adam1.byrd at gmail dot com
  2023-09-16  2:07 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-09-15 16:51 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90670

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |ppalka at gcc dot gnu.org

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
The warning seems right to me: the const DummyId has internal linkage, which
makes the type seChildScheduleAccess<DummyId> have internal linkage, which
makes the definition of seGccBugJob (strictly speaking) different in different
TUs.  So the warning is correctly exposing a potential ODR violation.

To fix the ODR violation, you can declare DummyId 'inline'.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/90670] const& template parameter in a header trips -Wsubobject-linkage
       [not found] <bug-90670-4@http.gcc.gnu.org/bugzilla/>
  2022-06-20 10:35 ` [Bug c++/90670] const& template parameter in a header trips -Wsubobject-linkage Kitsune-Ral at users dot sf.net
  2023-09-15 16:51 ` ppalka at gcc dot gnu.org
@ 2023-09-16  2:02 ` adam1.byrd at gmail dot com
  2023-09-16  2:07 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: adam1.byrd at gmail dot com @ 2023-09-16  2:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90670

--- Comment #3 from Adam Byrd <adam1.byrd at gmail dot com> ---
Hmm, I reckon that makes sense. Though the wording is confusing. Why is it
"uses the anonymous namespace" instead of something like "has internal
linkage".

I'm not aware of an anonymous namespace being involved here. Is that language
esoterica or a compiler implementation detail?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/90670] const& template parameter in a header trips -Wsubobject-linkage
       [not found] <bug-90670-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-09-16  2:02 ` adam1.byrd at gmail dot com
@ 2023-09-16  2:07 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-09-16  2:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90670

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=86491

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Adam Byrd from comment #3)
> I'm not aware of an anonymous namespace being involved here. Is that
> language esoterica or a compiler implementation detail?

Since GCC 13, the diagnostic is:
In file included from t66.cc:1:
t66.h:7:8: warning: ‘seGccBugJob’ has a field ‘seChildScheduleAccess<DummyId>
seGccBugJob::m_test’ whose type has internal linkage [-Wsubobject-linkage]
    7 | struct seGccBugJob
      |        ^~~~~~~~~~~

Basically the diagnostic was not updated for C++11 changes ...

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-09-16  2:07 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-90670-4@http.gcc.gnu.org/bugzilla/>
2022-06-20 10:35 ` [Bug c++/90670] const& template parameter in a header trips -Wsubobject-linkage Kitsune-Ral at users dot sf.net
2023-09-15 16:51 ` ppalka at gcc dot gnu.org
2023-09-16  2:02 ` adam1.byrd at gmail dot com
2023-09-16  2:07 ` 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).