public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96082] New: GCC rejects the template disambiguator with "typename"
@ 2020-07-06 15:59 haoxintu at gmail dot com
  2020-07-07  7:22 ` [Bug c++/96082] [9/10/11 Regression] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: haoxintu at gmail dot com @ 2020-07-06 15:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96082
           Summary: GCC rejects the template disambiguator with "typename"
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          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, test.cc, GCC rejects it in versions from 9.1 to trunk, but accepts
it from 8.3 to 4.8 versions. 

$cat test.cc
template <class> class A {};
int main () { 
    typename :: template A <int> a;
}

$g++ test.cc
test.cc: In function ‘int main()’:
test.cc:3:26: error: ‘template’ must follow a nested-name-specifier
    3 |     typename :: template A <int> a;
      |                          ^~~~~~~
test.cc:3:26: error: expected ‘(’
    3 |     typename :: template A <int> a;
      |                          ^~~~~~~
      |                    

I also tested in clang, icc, and msvc, they all accept this code.

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

* [Bug c++/96082] [9/10/11 Regression] GCC rejects the template disambiguator with "typename"
  2020-07-06 15:59 [Bug c++/96082] New: GCC rejects the template disambiguator with "typename" haoxintu at gmail dot com
@ 2020-07-07  7:22 ` rguenth at gcc dot gnu.org
  2020-07-07  8:52 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-07  7:22 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.4
            Summary|GCC rejects the template    |[9/10/11 Regression] GCC
                   |disambiguator with          |rejects the template
                   |"typename"                  |disambiguator with
                   |                            |"typename"

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

* [Bug c++/96082] [9/10/11 Regression] GCC rejects the template disambiguator with "typename"
  2020-07-06 15:59 [Bug c++/96082] New: GCC rejects the template disambiguator with "typename" haoxintu at gmail dot com
  2020-07-07  7:22 ` [Bug c++/96082] [9/10/11 Regression] " rguenth at gcc dot gnu.org
@ 2020-07-07  8:52 ` marxin at gcc dot gnu.org
  2020-08-03 23:59 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-07  8:52 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-07-07
                 CC|                            |marxin at gcc dot gnu.org,
                   |                            |mpolacek at gcc dot gnu.org

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started to be rejected with r9-4235-g9047dd02b84c42d6.

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

* [Bug c++/96082] [9/10/11 Regression] GCC rejects the template disambiguator with "typename"
  2020-07-06 15:59 [Bug c++/96082] New: GCC rejects the template disambiguator with "typename" haoxintu at gmail dot com
  2020-07-07  7:22 ` [Bug c++/96082] [9/10/11 Regression] " rguenth at gcc dot gnu.org
  2020-07-07  8:52 ` marxin at gcc dot gnu.org
@ 2020-08-03 23:59 ` mpolacek at gcc dot gnu.org
  2020-08-04 17:41 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-03 23:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
I have a patch.

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

* [Bug c++/96082] [9/10/11 Regression] GCC rejects the template disambiguator with "typename"
  2020-07-06 15:59 [Bug c++/96082] New: GCC rejects the template disambiguator with "typename" haoxintu at gmail dot com
                   ` (2 preceding siblings ...)
  2020-08-03 23:59 ` mpolacek at gcc dot gnu.org
@ 2020-08-04 17:41 ` cvs-commit at gcc dot gnu.org
  2020-08-04 18:17 ` [Bug c++/96082] [9/10 " cvs-commit at gcc dot gnu.org
  2020-08-04 18:24 ` [Bug c++/96082] [9 " mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-04 17:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Marek Polacek <mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:97def1f34c134d78d4423e9ac3e9b262417ea390

commit r11-2560-g97def1f34c134d78d4423e9ac3e9b262417ea390
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Aug 4 09:35:25 2020 -0400

    c++: Template keyword following :: [PR96082]

    In r9-4235 I tried to make sure that the template keyword follows
    a nested-name-specifier.  :: is a valid nested-name-specifier, so
    I also have to check 'globalscope' before giving the error.

    gcc/cp/ChangeLog:

            PR c++/96082
            * parser.c (cp_parser_elaborated_type_specifier): Allow
            'template' following ::.

    gcc/testsuite/ChangeLog:

            PR c++/96082
            * g++.dg/template/template-keyword3.C: New test.

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

* [Bug c++/96082] [9/10 Regression] GCC rejects the template disambiguator with "typename"
  2020-07-06 15:59 [Bug c++/96082] New: GCC rejects the template disambiguator with "typename" haoxintu at gmail dot com
                   ` (3 preceding siblings ...)
  2020-08-04 17:41 ` cvs-commit at gcc dot gnu.org
@ 2020-08-04 18:17 ` cvs-commit at gcc dot gnu.org
  2020-08-04 18:24 ` [Bug c++/96082] [9 " mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-08-04 18:17 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Marek Polacek
<mpolacek@gcc.gnu.org>:

https://gcc.gnu.org/g:1c4d223d37d067f5d372688c0c0cc5a05d977df7

commit r10-8576-g1c4d223d37d067f5d372688c0c0cc5a05d977df7
Author: Marek Polacek <polacek@redhat.com>
Date:   Tue Aug 4 09:35:25 2020 -0400

    c++: Template keyword following :: [PR96082]

    In r9-4235 I tried to make sure that the template keyword follows
    a nested-name-specifier.  :: is a valid nested-name-specifier, so
    I also have to check 'globalscope' before giving the error.

    gcc/cp/ChangeLog:

            PR c++/96082
            * parser.c (cp_parser_elaborated_type_specifier): Allow
            'template' following ::.

    gcc/testsuite/ChangeLog:

            PR c++/96082
            * g++.dg/template/template-keyword3.C: New test.

    (cherry picked from commit 97def1f34c134d78d4423e9ac3e9b262417ea390)

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

* [Bug c++/96082] [9 Regression] GCC rejects the template disambiguator with "typename"
  2020-07-06 15:59 [Bug c++/96082] New: GCC rejects the template disambiguator with "typename" haoxintu at gmail dot com
                   ` (4 preceding siblings ...)
  2020-08-04 18:17 ` [Bug c++/96082] [9/10 " cvs-commit at gcc dot gnu.org
@ 2020-08-04 18:24 ` mpolacek at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-04 18:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
            Summary|[9/10 Regression] GCC       |[9 Regression] GCC rejects
                   |rejects the template        |the template disambiguator
                   |disambiguator with          |with "typename"
                   |"typename"                  |
             Status|ASSIGNED                    |RESOLVED

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed for GCC 10.3+.

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

end of thread, other threads:[~2020-08-04 18:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-06 15:59 [Bug c++/96082] New: GCC rejects the template disambiguator with "typename" haoxintu at gmail dot com
2020-07-07  7:22 ` [Bug c++/96082] [9/10/11 Regression] " rguenth at gcc dot gnu.org
2020-07-07  8:52 ` marxin at gcc dot gnu.org
2020-08-03 23:59 ` mpolacek at gcc dot gnu.org
2020-08-04 17:41 ` cvs-commit at gcc dot gnu.org
2020-08-04 18:17 ` [Bug c++/96082] [9/10 " cvs-commit at gcc dot gnu.org
2020-08-04 18:24 ` [Bug c++/96082] [9 " mpolacek 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).