public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration
@ 2012-03-19 20:13 daniel.kruegler at googlemail dot com
  2012-03-20  7:59 ` [Bug c++/52625] " tsoae at mail dot ru
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-03-19 20:13 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52625

             Bug #: 52625
           Summary: Incorrect specialization semantics of friend class
                    template declaration
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: daniel.kruegler@googlemail.com


gcc 4.8.0 20120318 (experimental) rejects the following code:

//-----
template<class>
class base {};

class derived : public base<derived>
{
 template<class> friend class base; // Error
};
//-----

"error: specialization of 'base<derived>' after instantiation"

This code should be accepted, the friend declaration does not declare any
specialization.


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

* [Bug c++/52625] Incorrect specialization semantics of friend class template declaration
  2012-03-19 20:13 [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration daniel.kruegler at googlemail dot com
@ 2012-03-20  7:59 ` tsoae at mail dot ru
  2012-03-20  9:01 ` daniel.kruegler at googlemail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: tsoae at mail dot ru @ 2012-03-20  7:59 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52625

Nikolka <tsoae at mail dot ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tsoae at mail dot ru

--- Comment #1 from Nikolka <tsoae at mail dot ru> 2012-03-20 07:34:03 UTC ---
G++ issues the same diagnostic message for the following example:

    template<class>
        class base {};

    class derived : public base<derived>
    {
        // error: specialization of 'base<derived>' after instantiation
        template<class>
            friend class base<derived>;
    };

It seems that in the original example g++ incorrectly treats the
injected-class-name ::base<derived>::base as template specialization
base<derived>, while according to 14.6.1/1 it shall be refer to class template
base. Note that g++ does not issue an error in the following case:

    template<class>
        class base {};

    class derived : public base<derived>
    {
        template<class>
            friend class ::base;
    };

    int main() {}


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

* [Bug c++/52625] Incorrect specialization semantics of friend class template declaration
  2012-03-19 20:13 [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration daniel.kruegler at googlemail dot com
  2012-03-20  7:59 ` [Bug c++/52625] " tsoae at mail dot ru
@ 2012-03-20  9:01 ` daniel.kruegler at googlemail dot com
  2012-03-20 16:20 ` redi at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: daniel.kruegler at googlemail dot com @ 2012-03-20  9:01 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52625

--- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> 2012-03-20 08:41:48 UTC ---
(In reply to comment #1)
If this is indeed related to the injected-class-name, this should have been
clarified by

http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#1004

to not apply in this case.


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

* [Bug c++/52625] Incorrect specialization semantics of friend class template declaration
  2012-03-19 20:13 [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration daniel.kruegler at googlemail dot com
  2012-03-20  7:59 ` [Bug c++/52625] " tsoae at mail dot ru
  2012-03-20  9:01 ` daniel.kruegler at googlemail dot com
@ 2012-03-20 16:20 ` redi at gcc dot gnu.org
  2021-04-07 19:33 ` [Bug c++/52625] [8/9/10/11 Regression] " jason at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: redi at gcc dot gnu.org @ 2012-03-20 16:20 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52625

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2012-03-20
     Ever Confirmed|0                           |1

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-03-20 16:08:26 UTC ---
confirmed


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

* [Bug c++/52625] [8/9/10/11 Regression] Incorrect specialization semantics of friend class template declaration
  2012-03-19 20:13 [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration daniel.kruegler at googlemail dot com
                   ` (2 preceding siblings ...)
  2012-03-20 16:20 ` redi at gcc dot gnu.org
@ 2021-04-07 19:33 ` jason at gcc dot gnu.org
  2021-04-07 21:34 ` cvs-commit at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-07 19:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

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

* [Bug c++/52625] [8/9/10/11 Regression] Incorrect specialization semantics of friend class template declaration
  2012-03-19 20:13 [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration daniel.kruegler at googlemail dot com
                   ` (3 preceding siblings ...)
  2021-04-07 19:33 ` [Bug c++/52625] [8/9/10/11 Regression] " jason at gcc dot gnu.org
@ 2021-04-07 21:34 ` cvs-commit at gcc dot gnu.org
  2021-04-07 21:37 ` [Bug c++/52625] [8/9/10 " jason at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-07 21:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jason Merrill <jason@gcc.gnu.org>:

https://gcc.gnu.org/g:b40d45cb1930e9aa8a1f9a6a8728fd47ebeeaaac

commit r11-8034-gb40d45cb1930e9aa8a1f9a6a8728fd47ebeeaaac
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 7 15:38:07 2021 -0400

    c++: base template friend [PR52625]

    Here we were mistakenly treating the injected-class-name as a partial
    specialization.

    gcc/cp/ChangeLog:

            PR c++/52625
            * pt.c (maybe_process_partial_specialization): Check
            DECL_SELF_REFERENCE_P.

    gcc/testsuite/ChangeLog:

            PR c++/52625
            * g++.dg/template/friend70.C: New test.

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

* [Bug c++/52625] [8/9/10 Regression] Incorrect specialization semantics of friend class template declaration
  2012-03-19 20:13 [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration daniel.kruegler at googlemail dot com
                   ` (4 preceding siblings ...)
  2021-04-07 21:34 ` cvs-commit at gcc dot gnu.org
@ 2021-04-07 21:37 ` jason at gcc dot gnu.org
  2021-05-14  9:46 ` [Bug c++/52625] [9/10 " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2021-04-07 21:37 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |11.0
            Summary|[8/9/10/11 Regression]      |[8/9/10 Regression]
                   |Incorrect specialization    |Incorrect specialization
                   |semantics of friend class   |semantics of friend class
                   |template declaration        |template declaration

--- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 11 so far.

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

* [Bug c++/52625] [9/10 Regression] Incorrect specialization semantics of friend class template declaration
  2012-03-19 20:13 [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration daniel.kruegler at googlemail dot com
                   ` (5 preceding siblings ...)
  2021-04-07 21:37 ` [Bug c++/52625] [8/9/10 " jason at gcc dot gnu.org
@ 2021-05-14  9:46 ` jakub at gcc dot gnu.org
  2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14  9:46 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|8.5                         |9.4

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.

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

* [Bug c++/52625] [9/10 Regression] Incorrect specialization semantics of friend class template declaration
  2012-03-19 20:13 [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration daniel.kruegler at googlemail dot com
                   ` (6 preceding siblings ...)
  2021-05-14  9:46 ` [Bug c++/52625] [9/10 " jakub at gcc dot gnu.org
@ 2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
  2021-05-21 14:50 ` cvs-commit at gcc dot gnu.org
  2021-05-21 15:19 ` jason at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-20 21:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:de47fb31b13e6bd20d693cb1eef47cbfb5de20ce

commit r10-9850-gde47fb31b13e6bd20d693cb1eef47cbfb5de20ce
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 7 15:38:07 2021 -0400

    c++: base template friend [PR52625]

    Here we were mistakenly treating the injected-class-name as a partial
    specialization.

    gcc/cp/ChangeLog:

            PR c++/52625
            * pt.c (maybe_process_partial_specialization): Check
            DECL_SELF_REFERENCE_P.

    gcc/testsuite/ChangeLog:

            PR c++/52625
            * g++.dg/template/friend70.C: New test.

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

* [Bug c++/52625] [9/10 Regression] Incorrect specialization semantics of friend class template declaration
  2012-03-19 20:13 [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration daniel.kruegler at googlemail dot com
                   ` (7 preceding siblings ...)
  2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
@ 2021-05-21 14:50 ` cvs-commit at gcc dot gnu.org
  2021-05-21 15:19 ` jason at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-21 14:50 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jason Merrill
<jason@gcc.gnu.org>:

https://gcc.gnu.org/g:5b4cb06374890f2a190c9a989b569a9a15388445

commit r9-9548-g5b4cb06374890f2a190c9a989b569a9a15388445
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 7 15:38:07 2021 -0400

    c++: base template friend [PR52625]

    Here we were mistakenly treating the injected-class-name as a partial
    specialization.

    gcc/cp/ChangeLog:

            PR c++/52625
            * pt.c (maybe_process_partial_specialization): Check
            DECL_SELF_REFERENCE_P.

    gcc/testsuite/ChangeLog:

            PR c++/52625
            * g++.dg/template/friend70.C: New test.

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

* [Bug c++/52625] [9/10 Regression] Incorrect specialization semantics of friend class template declaration
  2012-03-19 20:13 [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration daniel.kruegler at googlemail dot com
                   ` (8 preceding siblings ...)
  2021-05-21 14:50 ` cvs-commit at gcc dot gnu.org
@ 2021-05-21 15:19 ` jason at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jason at gcc dot gnu.org @ 2021-05-21 15:19 UTC (permalink / raw)
  To: gcc-bugs

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

Jason Merrill <jason at gcc dot gnu.org> changed:

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

--- Comment #12 from Jason Merrill <jason at gcc dot gnu.org> ---
Fixed for 9.4/10.4/11.

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

end of thread, other threads:[~2021-05-21 15:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-19 20:13 [Bug c++/52625] New: Incorrect specialization semantics of friend class template declaration daniel.kruegler at googlemail dot com
2012-03-20  7:59 ` [Bug c++/52625] " tsoae at mail dot ru
2012-03-20  9:01 ` daniel.kruegler at googlemail dot com
2012-03-20 16:20 ` redi at gcc dot gnu.org
2021-04-07 19:33 ` [Bug c++/52625] [8/9/10/11 Regression] " jason at gcc dot gnu.org
2021-04-07 21:34 ` cvs-commit at gcc dot gnu.org
2021-04-07 21:37 ` [Bug c++/52625] [8/9/10 " jason at gcc dot gnu.org
2021-05-14  9:46 ` [Bug c++/52625] [9/10 " jakub at gcc dot gnu.org
2021-05-20 21:35 ` cvs-commit at gcc dot gnu.org
2021-05-21 14:50 ` cvs-commit at gcc dot gnu.org
2021-05-21 15:19 ` jason 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).