public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/93467] [concepts] getting "type constraint differs in template redeclaration" error after friend declaration in template
       [not found] <bug-93467-4@http.gcc.gnu.org/bugzilla/>
@ 2020-05-26 18:41 ` ppalka at gcc dot gnu.org
  2020-06-08 16:09 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-05-26 18:41 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ppalka at gcc dot gnu.org
      Known to fail|                            |10.0, 11.0
   Last reconfirmed|2020-01-28 00:00:00         |2020-5-26

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Reconfirmed on trunk.  I ran into this when writing a fix for PR
libstdc++/95322..

Here is another valid testcase which we reject:

template<bool B> requires B
  class C;

template<typename>
class S
{
  template<bool B> requires B
    friend class ::C;
};


testcase.C:8:20: error: ‘C<B>’ does not match original declaration
    8 |     friend class ::C;
      |                    ^
testcase.C:2:9: note: original template declaration here
    2 |   class C;
      |         ^

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

* [Bug c++/93467] [concepts] getting "type constraint differs in template redeclaration" error after friend declaration in template
       [not found] <bug-93467-4@http.gcc.gnu.org/bugzilla/>
  2020-05-26 18:41 ` [Bug c++/93467] [concepts] getting "type constraint differs in template redeclaration" error after friend declaration in template ppalka at gcc dot gnu.org
@ 2020-06-08 16:09 ` ppalka at gcc dot gnu.org
  2020-06-11 21:05 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-06-08 16:09 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

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

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

* [Bug c++/93467] [concepts] getting "type constraint differs in template redeclaration" error after friend declaration in template
       [not found] <bug-93467-4@http.gcc.gnu.org/bugzilla/>
  2020-05-26 18:41 ` [Bug c++/93467] [concepts] getting "type constraint differs in template redeclaration" error after friend declaration in template ppalka at gcc dot gnu.org
  2020-06-08 16:09 ` ppalka at gcc dot gnu.org
@ 2020-06-11 21:05 ` cvs-commit at gcc dot gnu.org
  2020-06-13 15:32 ` cvs-commit at gcc dot gnu.org
  2020-06-13 15:32 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-11 21:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:11c7261128ad3ee136508703b20e45cbe04f8dd0

commit r11-1243-g11c7261128ad3ee136508703b20e45cbe04f8dd0
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Jun 11 16:33:41 2020 -0400

    c++: constrained class template friend [PR93467]

    This fixes two issues in our handling of constrained class template
    friend declarations.

    The first issue is that we fail to set the constraints on the injected
    class template declaration during tsubst_friend_class.

    The second issue is that the template parameter levels within the parsed
    constraints of a class template friend declaration are shifted if the
    enclosing class is a template, and this shift leads to spurious
    constraint mismatch errors in associate_classtype_constraints if the
    friend declaration refers to an already declared class template.

    gcc/cp/ChangeLog:

            PR c++/93467
            * constraint.cc (associate_classtype_constraints): If there is a
            discrepancy between the current template depth and the template
            depth of the original declaration, then adjust the template
            parameter depth within the current constraints appropriately.
            * pt.c (tsubst_friend_class): Substitute into and set the
            constraints on the injected declaration.

    gcc/testsuite/ChangeLog:

            PR c++/93467
            * g++.dg/cpp2a/concepts-friend6.C: New test.
            * g++.dg/cpp2a/concepts-friend7.C: New test.

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

* [Bug c++/93467] [concepts] getting "type constraint differs in template redeclaration" error after friend declaration in template
       [not found] <bug-93467-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2020-06-11 21:05 ` cvs-commit at gcc dot gnu.org
@ 2020-06-13 15:32 ` cvs-commit at gcc dot gnu.org
  2020-06-13 15:32 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-13 15:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:652ec7e8c046b239c42dedd295acf1815ed2b93a

commit r10-8288-g652ec7e8c046b239c42dedd295acf1815ed2b93a
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Jun 11 16:33:41 2020 -0400

    c++: constrained class template friend [PR93467]

    This fixes two issues in our handling of constrained class template
    friend declarations.

    The first issue is that we fail to set the constraints on the injected
    class template declaration during tsubst_friend_class.

    The second issue is that the template parameter levels within the parsed
    constraints of a class template friend declaration are shifted if the
    enclosing class is a template, and this shift leads to spurious
    constraint mismatch errors in associate_classtype_constraints if the
    friend declaration refers to an already declared class template.

    gcc/cp/ChangeLog:

            PR c++/93467
            * constraint.cc (associate_classtype_constraints): If there is a
            discrepancy between the current template depth and the template
            depth of the original declaration, then adjust the template
            parameter depth within the current constraints appropriately.
            * pt.c (tsubst_friend_class): Substitute into and set the
            constraints on the injected declaration.

    gcc/testsuite/ChangeLog:

            PR c++/93467
            * g++.dg/cpp2a/concepts-friend6.C: New test.
            * g++.dg/cpp2a/concepts-friend7.C: New test.

    (cherry picked from commit 11c7261128ad3ee136508703b20e45cbe04f8dd0)

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

* [Bug c++/93467] [concepts] getting "type constraint differs in template redeclaration" error after friend declaration in template
       [not found] <bug-93467-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2020-06-13 15:32 ` cvs-commit at gcc dot gnu.org
@ 2020-06-13 15:32 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-06-13 15:32 UTC (permalink / raw)
  To: gcc-bugs

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

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED
   Target Milestone|---                         |10.2

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 10.2+.

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

end of thread, other threads:[~2020-06-13 15:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-93467-4@http.gcc.gnu.org/bugzilla/>
2020-05-26 18:41 ` [Bug c++/93467] [concepts] getting "type constraint differs in template redeclaration" error after friend declaration in template ppalka at gcc dot gnu.org
2020-06-08 16:09 ` ppalka at gcc dot gnu.org
2020-06-11 21:05 ` cvs-commit at gcc dot gnu.org
2020-06-13 15:32 ` cvs-commit at gcc dot gnu.org
2020-06-13 15:32 ` ppalka 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).