public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96604] New: rejects-valid on befriending specialization of conversion function template
@ 2020-08-13 17:13 richard-gccbugzilla at metafoo dot co.uk
  2020-08-13 17:15 ` [Bug c++/96604] " mpolacek at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: richard-gccbugzilla at metafoo dot co.uk @ 2020-08-13 17:13 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96604
           Summary: rejects-valid on befriending specialization of
                    conversion function template
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: richard-gccbugzilla at metafoo dot co.uk
  Target Milestone: ---

Testcase:

struct A { template<typename T> operator T(); };
struct X {};
struct B { friend A::operator X(); };

Per [temp.mem]/5 and /6, I think this is supposed to perform template argument
deduction against the conversion function template and befriend operator T with
T = B.

Clang, EDG, and MSVC accept.

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

* [Bug c++/96604] rejects-valid on befriending specialization of conversion function template
  2020-08-13 17:13 [Bug c++/96604] New: rejects-valid on befriending specialization of conversion function template richard-gccbugzilla at metafoo dot co.uk
@ 2020-08-13 17:15 ` mpolacek at gcc dot gnu.org
  2022-04-07 21:10 ` jason at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2020-08-13 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |mpolacek at gcc dot gnu.org
   Last reconfirmed|                            |2020-08-13
           Keywords|                            |rejects-valid
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thanks for the report.

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

* [Bug c++/96604] rejects-valid on befriending specialization of conversion function template
  2020-08-13 17:13 [Bug c++/96604] New: rejects-valid on befriending specialization of conversion function template richard-gccbugzilla at metafoo dot co.uk
  2020-08-13 17:15 ` [Bug c++/96604] " mpolacek at gcc dot gnu.org
@ 2022-04-07 21:10 ` jason at gcc dot gnu.org
  2022-04-09  1:51 ` cvs-commit at gcc dot gnu.org
  2022-04-29 21:25 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jason at gcc dot gnu.org @ 2022-04-07 21:10 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/96604] rejects-valid on befriending specialization of conversion function template
  2020-08-13 17:13 [Bug c++/96604] New: rejects-valid on befriending specialization of conversion function template richard-gccbugzilla at metafoo dot co.uk
  2020-08-13 17:15 ` [Bug c++/96604] " mpolacek at gcc dot gnu.org
  2022-04-07 21:10 ` jason at gcc dot gnu.org
@ 2022-04-09  1:51 ` cvs-commit at gcc dot gnu.org
  2022-04-29 21:25 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-09  1:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:58586721c79f77224b8571a5dba732620d5546ab

commit r12-8065-g58586721c79f77224b8571a5dba732620d5546ab
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Apr 6 23:46:53 2022 -0400

    c++: friend implicit template instantiation [PR91618]

    This rule that for a friend with a qualified name we try to find a
    matching template was already in C++98, but it seems we never implemented
    it, and nobody reported it until 2019.

    This patch sets DECL_IMPLICIT_INSTANTIATION to signal to
    check_explicit_specialization that we want to find a template, like
    grokfndecl already did for explicit template args.  check_classfn also
needs
    to call it, as check_classfn is called after the call to
    check_explicit_specialization in grokfndecl, whereas the call to
    set_decl_namespace comes sooner.  This inconsistency is inelegant, but
safer
    at this point in the release cycle; I'll unify them in stage 1.

            PR c++/91618
            PR c++/96604

    gcc/cp/ChangeLog:

            * name-lookup.cc (set_decl_namespace): Set
            DECL_IMPLICIT_INSTANTIATION if no non-template match.
            * pt.cc (check_explicit_specialization): Check it.
            * decl2.cc (check_classfn): Call it.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp0x/friend7.C: Remove xfail.
            * g++.dg/template/friend72.C: New test.
            * g++.dg/template/friend72a.C: New test.
            * g++.dg/template/friend73.C: New test.

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

* [Bug c++/96604] rejects-valid on befriending specialization of conversion function template
  2020-08-13 17:13 [Bug c++/96604] New: rejects-valid on befriending specialization of conversion function template richard-gccbugzilla at metafoo dot co.uk
                   ` (2 preceding siblings ...)
  2022-04-09  1:51 ` cvs-commit at gcc dot gnu.org
@ 2022-04-29 21:25 ` cvs-commit at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-04-29 21:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 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:e9d2adc17d0dbe46db67e1b618dea888d5c7aca3

commit r13-55-ge9d2adc17d0dbe46db67e1b618dea888d5c7aca3
Author: Jason Merrill <jason@redhat.com>
Date:   Fri Apr 8 13:48:25 2022 -0400

    c++: reorganize friend template matching [PR91618]

    The the different calling of check_explicit_specialization for class and
    namespace scope friends bothered me, so this patch combines them.

            PR c++/91618
            PR c++/96604

    gcc/cp/ChangeLog:

            * friend.cc (do_friend): Call check_explicit_specialization here.
            * decl.cc (grokdeclarator): Not here.
            * decl2.cc (check_classfn): Or here.

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

end of thread, other threads:[~2022-04-29 21:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-13 17:13 [Bug c++/96604] New: rejects-valid on befriending specialization of conversion function template richard-gccbugzilla at metafoo dot co.uk
2020-08-13 17:15 ` [Bug c++/96604] " mpolacek at gcc dot gnu.org
2022-04-07 21:10 ` jason at gcc dot gnu.org
2022-04-09  1:51 ` cvs-commit at gcc dot gnu.org
2022-04-29 21:25 ` cvs-commit 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).