public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114934] New: Error message for expected unqualified-id could be improved
@ 2024-05-03  9:21 hewillk at gmail dot com
  2024-05-03 18:05 ` [Bug c++/114934] " redi at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: hewillk at gmail dot com @ 2024-05-03  9:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 114934
           Summary: Error message for expected unqualified-id could be
                    improved
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

Suppose I misspelled an extra colon for the namespace
(https://godbolt.org/z/q3b7531q3):

#include <tuple>
#include <string>

using Tuple = std::tuple<std:::string, int>;

GCC gives:

<source>:4:43: error: template argument 1 is invalid
    4 | using Tuple = std::tuple<std:::string, int>;
      |                                           ^

Although it is not stated why it is invalid, it is still acceptable.

Clang gives:

<source>:4:31: error: expected unqualified-id
    4 | using Tuple = std::tuple<std:::string, int>;
      |                               ^

It correctly points out the location of the issue which is nice.

However, I changed it to the following (https://godbolt.org/z/zfoqeoxE3):

#include <tuple>
#include <string>

using Pair = std::pair<std:::string, int>;

GCC will give:

<source>:4:41: error: wrong number of template arguments (1, should be 2)
    4 | using Pair = std::pair<std:::string, int>;
      |          

This is unkind because it doesn't indicate which one is invalid, but rather the
*wrong number* of arguments. This can be very confusing to users who haven't
discovered the typo, as there are indeed 2 template parameters here (which can
make debugging extremely difficult if there are plenty of template parameters
in the template list)

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

* [Bug c++/114934] Error message for expected unqualified-id could be improved
  2024-05-03  9:21 [Bug c++/114934] New: Error message for expected unqualified-id could be improved hewillk at gmail dot com
@ 2024-05-03 18:05 ` redi at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: redi at gcc dot gnu.org @ 2024-05-03 18:05 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2024-05-03
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-03  9:21 [Bug c++/114934] New: Error message for expected unqualified-id could be improved hewillk at gmail dot com
2024-05-03 18:05 ` [Bug c++/114934] " 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).