public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99404] New: Diagnostics for undeclared members of a namespace don't say "namespace"
@ 2021-03-05 10:04 redi at gcc dot gnu.org
  2023-08-07 10:09 ` [Bug c++/99404] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2021-03-05 10:04 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99404
           Summary: Diagnostics for undeclared members of a namespace
                    don't say "namespace"
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#include <chrono>
#include <future>
int main()
{
  std::this_thread::sleep_until(std::chrono::system_clock::now());
}

This invalid program gives:

ns.C: In function 'int main()':
ns.C:5:21: error: 'sleep_until' is not a member of 'std::this_thread'
    5 |   std::this_thread::sleep_until(std::chrono::system_clock::now());
      |                     ^~~~~~~~~~~

It might be helpful to casual C++ programmers if it was clear that
'std::this_thread' is a namespace, and not a class type or global variable e.g.

ns.C:5:21: error: 'sleep_until' is not a member of namespace 'std::this_thread'


Minimal example:

namespace N { }
void f() {
  using N::a;
  N::b();
}

ns2.C: In function ‘void f()’:
ns2.C:3:12: error: ‘a’ has not been declared in ‘N’
    3 |   using N::a;
      |            ^
ns2.C:4:6: error: ‘b’ is not a member of ‘N’
    4 |   N::b();
      |      ^

Also, is there a reason these two diagnostics are worded differently?


Clang says:

ns2.C:3:12: error: no member named 'a' in namespace 'N'
  using N::a;
        ~~~^
ns2.C:4:6: error: no member named 'b' in namespace 'N'
  N::b();
  ~~~^
2 errors generated.


And EDG says:

"ns2.C", line 3: error: namespace "N" has no member "a"
    using N::a;
             ^

"ns2.C", line 4: error: namespace "N" has no member "b"
    N::b();
       ^

2 errors detected in the compilation of "ns2.C".

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

* [Bug c++/99404] Diagnostics for undeclared members of a namespace don't say "namespace"
  2021-03-05 10:04 [Bug c++/99404] New: Diagnostics for undeclared members of a namespace don't say "namespace" redi at gcc dot gnu.org
@ 2023-08-07 10:09 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2023-08-07 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-08-07

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

end of thread, other threads:[~2023-08-07 10:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 10:04 [Bug c++/99404] New: Diagnostics for undeclared members of a namespace don't say "namespace" redi at gcc dot gnu.org
2023-08-07 10:09 ` [Bug c++/99404] " redi 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).