public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96209] New: Redundant error message split out when adding "typename" keyword
@ 2020-07-15 15:23 haoxintu at gmail dot com
  2021-08-11 23:15 ` [Bug c++/96209] " pinskia at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: haoxintu at gmail dot com @ 2020-07-15 15:23 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96209
           Summary: Redundant error message split out when adding
                    "typename" keyword
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi, all.

This code, test1.cc and test2.cc ( they are in the same meaning I guess), are
invalid code with a little mistake, but the compiling output is different when
I add the "typename" keyword. Here are the examples:

$cat test1.cc
template <class...> class T{};
:: T < int ... > 
foo ( ... )
{ } 

$cat test2.cc
template <class...> class T{};
typename :: T < int ... > 
foo ( ... )
{ } 

$g++ -w test1.cc
test1.cc:2:12: error: expansion pattern ‘int’ contains no parameter packs
    2 | :: T < int ... >
      |            ^~~
test1.cc:2:16: error: template argument 1 is invalid
    2 | :: T < int ... >
      |                ^

$g++ -w test2.cc
test2.cc:2:21: error: expansion pattern ‘int’ contains no parameter packs
    2 | typename :: T < int ... >
      |                     ^~~
test2.cc:2:25: error: template argument 1 is invalid
    2 | typename :: T < int ... >
      |                         ^
test2.cc:3:1: error: ‘foo’ in namespace ‘::’ does not name a type
    3 | foo ( ... )
      | ^~~
test2.cc:3:7: error: expected unqualified-id before ‘...’ token
    3 | foo ( ... )
      |       ^~~
test2.cc:3:6: error: expected ‘)’ before ‘...’ token
    3 | foo ( ... )
      |     ~^~~~
      |      )

The first two message are ok in test2.cc. And the following message in
unnecessary and useless.

While in clang, only one error message ("error: pack expansion does not contain
any unexpanded parameter packs") is edited in both two cases.

I guess GCC has some room to improve this diagnostic case. Every GCC version
from 5.x onwards behaves the same.

Thanks,
Haoxin

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

* [Bug c++/96209] Redundant error message split out when adding "typename" keyword
  2020-07-15 15:23 [Bug c++/96209] New: Redundant error message split out when adding "typename" keyword haoxintu at gmail dot com
@ 2021-08-11 23:15 ` pinskia at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-11 23:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-08-11
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

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

end of thread, other threads:[~2021-08-11 23:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 15:23 [Bug c++/96209] New: Redundant error message split out when adding "typename" keyword haoxintu at gmail dot com
2021-08-11 23:15 ` [Bug c++/96209] " 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).