public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94336] New: template keyword accepted before destructor names
@ 2020-03-26  1:26 mpolacek at gcc dot gnu.org
  2020-03-26  9:50 ` [Bug c++/94336] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-03-26  1:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94336
           Summary: template keyword accepted before destructor names
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

We accept the following:

template<typename T> void f(T *p) { p->template ~X(); }
template<typename T> struct X {};
void g(X<int> *p) { f(p); }

but arguably we shouldn't because [temp.names]/5: A name prefixed by the
keyword template shall be a template-id or the name shall refer to a class
template or an alias template.

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

* [Bug c++/94336] template keyword accepted before destructor names
  2020-03-26  1:26 [Bug c++/94336] New: template keyword accepted before destructor names mpolacek at gcc dot gnu.org
@ 2020-03-26  9:50 ` redi at gcc dot gnu.org
  2020-03-26 12:58 ` mpolacek at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: redi at gcc dot gnu.org @ 2020-03-26  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-03-26
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
EDG also accepts it, and clang 9.0.1 segfaults! clang 11 rejects it:

d.cc:1:50: error: unknown type name 'X'
template<typename T> void f(T *p) { p->template ~X(); }
                                                 ^
1 error generated.

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

* [Bug c++/94336] template keyword accepted before destructor names
  2020-03-26  1:26 [Bug c++/94336] New: template keyword accepted before destructor names mpolacek at gcc dot gnu.org
  2020-03-26  9:50 ` [Bug c++/94336] " redi at gcc dot gnu.org
@ 2020-03-26 12:58 ` mpolacek at gcc dot gnu.org
  2020-03-26 22:51 ` mpolacek at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-03-26 12:58 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

* [Bug c++/94336] template keyword accepted before destructor names
  2020-03-26  1:26 [Bug c++/94336] New: template keyword accepted before destructor names mpolacek at gcc dot gnu.org
  2020-03-26  9:50 ` [Bug c++/94336] " redi at gcc dot gnu.org
  2020-03-26 12:58 ` mpolacek at gcc dot gnu.org
@ 2020-03-26 22:51 ` mpolacek at gcc dot gnu.org
  2020-03-27  2:08 ` cvs-commit at gcc dot gnu.org
  2020-03-27  2:09 ` mpolacek at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-03-26 22:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
https://gcc.gnu.org/pipermail/gcc-patches/2020-March/542767.html

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

* [Bug c++/94336] template keyword accepted before destructor names
  2020-03-26  1:26 [Bug c++/94336] New: template keyword accepted before destructor names mpolacek at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-03-26 22:51 ` mpolacek at gcc dot gnu.org
@ 2020-03-27  2:08 ` cvs-commit at gcc dot gnu.org
  2020-03-27  2:09 ` mpolacek at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-03-27  2:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:71d69548a1b2c85220ac6354564fd272beb9263f

commit r10-7408-g71d69548a1b2c85220ac6354564fd272beb9263f
Author: Marek Polacek <polacek@redhat.com>
Date:   Thu Mar 26 16:07:17 2020 -0400

    c++: template keyword accepted before destructor names [PR94336]

    This came up on the C++ core list recently.  We don't diagnose the case
    when 'template' is followed by a destructor name which is not permitted
    by [temp.names]/5.

            PR c++/94336 - template keyword accepted before destructor names.
            * parser.c (cp_parser_unqualified_id): Give an error when
'template'
            is followed by a destructor name.

            * g++.dg/template/template-keyword2.C: New test.

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

* [Bug c++/94336] template keyword accepted before destructor names
  2020-03-26  1:26 [Bug c++/94336] New: template keyword accepted before destructor names mpolacek at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-03-27  2:08 ` cvs-commit at gcc dot gnu.org
@ 2020-03-27  2:09 ` mpolacek at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-03-27  2:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2020-03-27  2:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-26  1:26 [Bug c++/94336] New: template keyword accepted before destructor names mpolacek at gcc dot gnu.org
2020-03-26  9:50 ` [Bug c++/94336] " redi at gcc dot gnu.org
2020-03-26 12:58 ` mpolacek at gcc dot gnu.org
2020-03-26 22:51 ` mpolacek at gcc dot gnu.org
2020-03-27  2:08 ` cvs-commit at gcc dot gnu.org
2020-03-27  2:09 ` 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).