public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "vanyacpp at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/105099] New: In lookup for namespace name qualifiers only namespaces should be considered
Date: Tue, 29 Mar 2022 17:24:57 +0000	[thread overview]
Message-ID: <bug-105099-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105099
           Summary: In lookup for namespace name qualifiers only
                    namespaces should be considered
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vanyacpp at gmail dot com
  Target Milestone: ---

Consider this code:

namespace a
{
    namespace c
    {}

    struct a
    {};

    namespace b = a::c;   // (1)
    using namespace a::c; // (2)
}

Currently GCC prints an error:

file.cpp:9:22: error: 'c' is not a namespace-name
    9 |     namespace b = a::c;
      |                      ^
file.cpp:10:24: error: 'c' is not a namespace-name
   10 |     using namespace a::c;
      |                        ^

If I interpret the standard correctly the code should compile without errors
because during the lookup of the qualifier the struct "a" should be ignored and
the namespace "a" should be found.

[basic.lookup.udir]p1: In a using-directive or namespace-alias-definition,
during the lookup for a namespace-name or for a name in a nested-name-specifier
only namespace names are considered.

https://eel.is/c++draft/basic.lookup.udir
https://godbolt.org/z/vaWjx4cKj

             reply	other threads:[~2022-03-29 17:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29 17:24 vanyacpp at gmail dot com [this message]
2022-03-30  9:35 ` [Bug c++/105099] In lookup of " redi at gcc dot gnu.org
2022-03-30  9:38 ` redi at gcc dot gnu.org
2022-03-30 12:02 ` [Bug c++/105099] [9/10/11/12 Regression] " redi at gcc dot gnu.org
2022-04-04 11:33 ` rguenth at gcc dot gnu.org
2022-05-27  9:47 ` [Bug c++/105099] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:48 ` jakub at gcc dot gnu.org
2023-07-07 10:42 ` [Bug c++/105099] [11/12/13/14 " rguenth 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-105099-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: link
Be 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).