public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "blubban at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/105595] New: Coroutines can trigger -Wsubobject-linkage Date: Fri, 13 May 2022 16:21:12 +0000 [thread overview] Message-ID: <bug-105595-4@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2022-05-13 16:21 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-05-13 16:21 blubban at gmail dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-105595-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).