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

* [Bug c++/95809] GCC treats inline namespace declaration as "ambiguous"
  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 ` redi at gcc dot gnu.org
  2020-06-25 13:44 ` nathan at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2020-06-25 12:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nathan at gcc dot gnu.org

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This changed with r248521

    Implement DR2061

            gcc/
            Implement DR2061
            * name-lookup.c (push_inline_namespaces): New.
            (push_namespace): Look inside inline namespaces.

            testsuite/
            * g++.dg/cpp0x/dr2061.C: New.
            * g++.dg/parse/namespace-alias-1.C: Add more test.

I'm not sure the code is valid, but I'll let Nathan comment.

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

* [Bug c++/95809] GCC treats inline namespace declaration as "ambiguous"
  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
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-06-25 13:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
yup, dr2061 made that ill-formed.  

p1701 (wg21.link/p1701) documents the behaviour and it appears EWG is exploring
another avenue to resolve the underlying problem 2061 was attempting to fix.

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

* [Bug c++/95809] GCC treats inline namespace declaration as "ambiguous"
  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
  4 siblings, 0 replies; 6+ messages in thread
From: haoxintu at gmail dot com @ 2020-06-26  9:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Haoxin Tu <haoxintu at gmail dot com> ---
(In reply to Nathan Sidwell from comment #2)
> yup, dr2061 made that ill-formed.  
> 
> p1701 (wg21.link/p1701) documents the behaviour and it appears EWG is
> exploring another avenue to resolve the underlying problem 2061 was
> attempting to fix.

Thank you, Nathan, so this is a valid code, right?

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

* [Bug c++/95809] GCC treats inline namespace declaration as "ambiguous"
  2020-06-22  6:43 [Bug c++/95809] New: GCC treats inline namespace declaration as "ambiguous" haoxintu at gmail dot com
                   ` (2 preceding siblings ...)
  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
  4 siblings, 0 replies; 6+ messages in thread
From: nathan at gcc dot gnu.org @ 2020-06-26 13:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Nathan Sidwell <nathan at gcc dot gnu.org> ---
The code is invalid due to DR2061

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

* [Bug c++/95809] [DR2061]GCC treats inline namespace declaration as "ambiguous"
  2020-06-22  6:43 [Bug c++/95809] New: GCC treats inline namespace declaration as "ambiguous" haoxintu at gmail dot com
                   ` (3 preceding siblings ...)
  2020-06-26 13:16 ` nathan at gcc dot gnu.org
@ 2021-12-14  5:01 ` pinskia at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-14  5:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
              Alias|                            |cwg2061
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |INVALID

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Invalid as explained.

^ 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).