public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105595] New: Coroutines can trigger -Wsubobject-linkage
@ 2022-05-13 16:21 blubban at gmail dot com
  2022-11-07 16:53 ` [Bug c++/105595] " pinskia at gcc dot gnu.org
  2022-12-09 15:23 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: blubban at gmail dot com @ 2022-05-13 16:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105595
           Summary: Coroutines can trigger -Wsubobject-linkage
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: blubban at gmail dot com
  Target Milestone: ---

To reproduce:
- Create a minimal coroutine promise
- Create a coroutine where any local's type has no linkage (for example a
lambda)
- #include the above from another, differently named, file

Result:
/app/not_example.cpp:25:1: warning: 'foo()::_Z3foov.Frame' has a field
'foo()::_Z3foov.Frame::anon_ns_1_2' whose type uses the anonymous namespace
[-Wsubobject-linkage]
/app/not_example.cpp:25:1: warning: 'foo()::_Z3foov.Frame' has a field
'foo()::_Z3foov.Frame::inner_class_1_2' whose type has no linkage
[-Wsubobject-linkage]
/app/not_example.cpp:25:1: warning: 'foo()::_Z3foov.Frame' has a field
'foo()::_Z3foov.Frame::a_lambda_1_2' whose type has no linkage
[-Wsubobject-linkage]

Expected:
No warning, because the coroutine frame's type shouldn't have linkage either.
Sticking anonymous types inside each other is harmless.

Full testcase:


# 2 "/app/not_example.cpp" 1

#include <coroutine>

class async {
public:
    class promise_type {
    public:
        async get_return_object() { return {}; }
        std::suspend_never initial_suspend() { return {}; }
        std::suspend_never final_suspend() noexcept { return {}; }
        void unhandled_exception() {}
    };
};

namespace {
    class anon_ns_t {};
}

async foo()
{
    anon_ns_t anon_ns;
    class inner_class_t {} inner_class;
    auto a_lambda = [](){};
    co_await std::suspend_never{};
}


Compile with -std=c++20.

Compiler Explorer: https://godbolt.org/z/efz6dfoWq

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

* [Bug c++/105595] Coroutines can trigger -Wsubobject-linkage
  2022-05-13 16:21 [Bug c++/105595] New: Coroutines can trigger -Wsubobject-linkage blubban at gmail dot com
@ 2022-11-07 16:53 ` pinskia at gcc dot gnu.org
  2022-12-09 15:23 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-11-07 16:53 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dennis-hezel at gmx dot de

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 107556 has been marked as a duplicate of this bug. ***

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

* [Bug c++/105595] Coroutines can trigger -Wsubobject-linkage
  2022-05-13 16:21 [Bug c++/105595] New: Coroutines can trigger -Wsubobject-linkage blubban at gmail dot com
  2022-11-07 16:53 ` [Bug c++/105595] " pinskia at gcc dot gnu.org
@ 2022-12-09 15:23 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-09 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-12-09

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. I noticed this also when reducing a different testcase.

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

end of thread, other threads:[~2022-12-09 15:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-13 16:21 [Bug c++/105595] New: Coroutines can trigger -Wsubobject-linkage blubban at gmail dot com
2022-11-07 16:53 ` [Bug c++/105595] " pinskia at gcc dot gnu.org
2022-12-09 15:23 ` 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).