public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106604] New: Fully-specified deduction guide in anonymous namespace warns as-if a function? Unsuppressably?
@ 2022-08-13  0:17 nabijaczleweli at nabijaczleweli dot xyz
  2022-08-14 19:36 ` [Bug c++/106604] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: nabijaczleweli at nabijaczleweli dot xyz @ 2022-08-13  0:17 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106604
           Summary: Fully-specified deduction guide in anonymous namespace
                    warns as-if a function? Unsuppressably?
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nabijaczleweli at nabijaczleweli dot xyz
  Target Milestone: ---

Reproduced this separately on 10.2.1-6 (bullseye), 12.1.0-7 (sid from 2 weeks
ago), trunk (according to godbolt).

TL;DR: https://gcc.godbolt.org/z/869TdbvEe


Given:
  namespace {
      template <class T>
      struct test {
          test(T) noexcept {}
      };

      UNUSED test(bool) -> test<bool>;
  }

If UNUSED is blank, GCC produces:
  <source>:7:12: warning: '{anonymous}::test(int) -> test<int>' declared
'static' but never defined [-Wunused-function]
      7 |     UNUSED test(int) -> test<int>;
        |            ^~~~
  Compiler returned: 0


If UNUSED is [[maybe_unused]] (which was my solution originally since it works
on Clang):
  <source>:0:16: error: 'decl-specifier' in declaration of deduction guide
      0 | #define UNUSED [[maybe_unused]]
        |                ^
  <source>:7:5: note: in expansion of macro 'UNUSED'
      7 |     UNUSED test(int) -> test<int>;
        |     ^~~~~~
  <source>:7:12: warning: '{anonymous}::test(int) -> test<int>' declared
'static' but never defined [-Wunused-function]
      7 |     UNUSED test(int) -> test<int>;
        |            ^~~~
  Compiler returned: 1


So:
  * the deduction guide is decidedly not "declared 'static'" (anon namespace
means it has static linkage, sure, but it's not 'static')
  * of course it's not defined?? can you even define a deduction guide?
  * how do you suppress this? (besides template<class = void>)?

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

end of thread, other threads:[~2023-08-15 13:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-13  0:17 [Bug c++/106604] New: Fully-specified deduction guide in anonymous namespace warns as-if a function? Unsuppressably? nabijaczleweli at nabijaczleweli dot xyz
2022-08-14 19:36 ` [Bug c++/106604] " pinskia at gcc dot gnu.org
2023-05-19  4:19 ` pinskia at gcc dot gnu.org
2023-08-12  1:13 ` cvs-commit at gcc dot gnu.org
2023-08-15 13:19 ` 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).