public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/116770] New: Diagnostic 'explicit qualification in declaration of' could be clearer when explicit namespace qualifier matches the open namespace
@ 2024-09-18 18:38 cjdb.ns at gmail dot com
  2024-09-18 19:42 ` [Bug c++/116770] " redi at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: cjdb.ns at gmail dot com @ 2024-09-18 18:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 116770
           Summary: Diagnostic 'explicit qualification in declaration of'
                    could be clearer when explicit namespace qualifier
                    matches the open namespace
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cjdb.ns at gmail dot com
  Target Milestone: ---

```
namespace foo {
  void f();
}

namespace foo {
  void foo::f() {}
}
```

gives this diagnostic

```
error: explicit qualification in declaration of 'void foo::f()'
    6 |   void foo::f() {}
      |        ^~~
```

While technically accurate, the diagnostic could go a bit further and diagnose
that the author might have meant to define `foo::f`. Would it be possible to
add a note please?

```
error: explicit qualification in declaration of 'void foo::f()'
    6 |   void foo::f() {}
      |        ^~~
note: this 'void foo::f()` was found inside a 'namespace foo' block; did you
mean 'void f()`?
```

Alternatively, Clang diagnoses this as a warning instead of an error; perhaps
GCC could match this, either in text or in functionality.

```
warning: extra qualification on member 'f' [-Wextra-qualification]
    6 |   void foo::f() {}
      |             ^
```

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

* [Bug c++/116770] Diagnostic 'explicit qualification in declaration of' could be clearer when explicit namespace qualifier matches the open namespace
  2024-09-18 18:38 [Bug c++/116770] New: Diagnostic 'explicit qualification in declaration of' could be clearer when explicit namespace qualifier matches the open namespace cjdb.ns at gmail dot com
@ 2024-09-18 19:42 ` redi at gcc dot gnu.org
  2024-09-18 20:57 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2024-09-18 19:42 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |diagnostic
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-09-18
           Severity|normal                      |enhancement

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
EDG accepts it without any diagnostic.

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

* [Bug c++/116770] Diagnostic 'explicit qualification in declaration of' could be clearer when explicit namespace qualifier matches the open namespace
  2024-09-18 18:38 [Bug c++/116770] New: Diagnostic 'explicit qualification in declaration of' could be clearer when explicit namespace qualifier matches the open namespace cjdb.ns at gmail dot com
  2024-09-18 19:42 ` [Bug c++/116770] " redi at gcc dot gnu.org
@ 2024-09-18 20:57 ` pinskia at gcc dot gnu.org
  2024-09-18 21:00 ` mpolacek at gcc dot gnu.org
  2024-09-18 21:03 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-18 20:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
DR482

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

* [Bug c++/116770] Diagnostic 'explicit qualification in declaration of' could be clearer when explicit namespace qualifier matches the open namespace
  2024-09-18 18:38 [Bug c++/116770] New: Diagnostic 'explicit qualification in declaration of' could be clearer when explicit namespace qualifier matches the open namespace cjdb.ns at gmail dot com
  2024-09-18 19:42 ` [Bug c++/116770] " redi at gcc dot gnu.org
  2024-09-18 20:57 ` pinskia at gcc dot gnu.org
@ 2024-09-18 21:00 ` mpolacek at gcc dot gnu.org
  2024-09-18 21:03 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-09-18 21:00 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

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

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> DR482

We have bug 64267 for that.

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

* [Bug c++/116770] Diagnostic 'explicit qualification in declaration of' could be clearer when explicit namespace qualifier matches the open namespace
  2024-09-18 18:38 [Bug c++/116770] New: Diagnostic 'explicit qualification in declaration of' could be clearer when explicit namespace qualifier matches the open namespace cjdb.ns at gmail dot com
                   ` (2 preceding siblings ...)
  2024-09-18 21:00 ` mpolacek at gcc dot gnu.org
@ 2024-09-18 21:03 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-09-18 21:03 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=64267

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #3)
> (In reply to Andrew Pinski from comment #2)
> > DR482
> 
> We have bug 64267 for that.

Right I was just looking that up :).

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

end of thread, other threads:[~2024-09-18 21:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-18 18:38 [Bug c++/116770] New: Diagnostic 'explicit qualification in declaration of' could be clearer when explicit namespace qualifier matches the open namespace cjdb.ns at gmail dot com
2024-09-18 19:42 ` [Bug c++/116770] " redi at gcc dot gnu.org
2024-09-18 20:57 ` pinskia at gcc dot gnu.org
2024-09-18 21:00 ` mpolacek at gcc dot gnu.org
2024-09-18 21:03 ` 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).