public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95809] New: GCC treats inline namespace declaration as "ambiguous"
@ 2020-06-22  6:43 haoxintu at gmail dot com
  2020-06-25 12:16 ` [Bug c++/95809] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-22  6:43 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 95809
           Summary: GCC treats inline namespace declaration as "ambiguous"
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

This code, bug.cc, GCC fails to compile it, while clang, icc, or msvc accepts
it well.

$cat bug.cc
namespace g_namespace {}
inline namespace {
    namespace g_namespace {}
}
namespace g_namespace {}

$g++ -c bug.cc
bug.cc:5:12: error: ‘namespace g_namespace’ is ambiguous
    5 | namespace  g_namespace {}
      |            ^~~~~~~~~~~
bug.cc:3:15: note: candidates are: ‘namespace <unnamed>::g_namespace { }’
    3 |     namespace g_namespace {}
      |               ^~~~~~~~~~~
bug.cc:1:11: note:                 ‘namespace g_namespace { }’
    1 | namespace g_namespace {}
      |           ^~~~~~~~~~~

My GCC version is
g++ (GCC) 11.0.0 20200605 (experimental)
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


When I remove the keyword "inline", GCC accepts it well. So, I guess GCC might
can not detect the inline namespace declaration and separate its inside
namespace from outside ones.

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

end of thread, other threads:[~2021-12-14  5:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-22  6:43 [Bug c++/95809] New: GCC treats inline namespace declaration as "ambiguous" haoxintu at gmail dot com
2020-06-25 12:16 ` [Bug c++/95809] " redi at gcc dot gnu.org
2020-06-25 13:44 ` nathan at gcc dot gnu.org
2020-06-26  9:47 ` haoxintu at gmail dot com
2020-06-26 13:16 ` nathan at gcc dot gnu.org
2021-12-14  5:01 ` [Bug c++/95809] [DR2061]GCC " 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).