public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103678] New: [concepts] Constrained partial specialization of dependent template conflicts with unconstrained partial specialization
@ 2021-12-13  1:54 matthewjbarichello at gmail dot com
  2021-12-13  9:40 ` [Bug c++/103678] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: matthewjbarichello at gmail dot com @ 2021-12-13  1:54 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103678
           Summary: [concepts] Constrained partial specialization of
                    dependent template conflicts with unconstrained
                    partial specialization
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matthewjbarichello at gmail dot com
  Target Milestone: ---

Reduced example:

  template<typename>
  struct A {
   template<typename...>
   struct B;
  };

  template<typename A_t>
  template<typename B_t>
  struct A<A_t>::B<B_t> {};

  template<typename A_t>
  template<typename B_t>
  requires requires {
   typename B_t;
  }
  struct A<A_t>::B<B_t> {};

Cmdline:

  g++ -std=c++20 example.cpp

Expected behaviour:
Example compiles. The partial specialization defined on line 16 should be a
distinct partial specialization as it is more constrained than the base
template and the partial specialization on line 9.

Actual behaviour:
Example does not compile and compiler emits the following diagnostic:

  <source>:16:16: error: redefinition of 'struct A< <template-parameter-1-1>
>::B<B_t>'
     16 | struct A<A_t>::B<B_t> {};
        |                ^~~~~~
  <source>:9:16: note: previous definition of 'struct A<
<template-parameter-1-1> >::B<B_t>'
      9 | struct A<A_t>::B<B_t> {};
        |                ^~~~~~

Affected versions:
GCC 10 through 12.

Notes:
 - Compiles fine on Clang and MSVC.
 - Only seems to happen for partially specialized dependent templates, as the
following code compiles without an error:
    template<typename...>
    struct A;

    template<typename A_t>
    struct A<A_t> {};

    template<typename A_t>
    requires requires {
     typename A_t;
    }
    struct A<A_t> {};

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

* [Bug c++/103678] [concepts] Constrained partial specialization of dependent template conflicts with unconstrained partial specialization
  2021-12-13  1:54 [Bug c++/103678] New: [concepts] Constrained partial specialization of dependent template conflicts with unconstrained partial specialization matthewjbarichello at gmail dot com
@ 2021-12-13  9:40 ` redi at gcc dot gnu.org
  2022-01-27 16:02 ` cvs-commit at gcc dot gnu.org
  2022-01-27 16:04 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2021-12-13  9:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-12-13
             Blocks|                            |67491
     Ever confirmed|0                           |1


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67491
[Bug 67491] [meta-bug] concepts issues

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

* [Bug c++/103678] [concepts] Constrained partial specialization of dependent template conflicts with unconstrained partial specialization
  2021-12-13  1:54 [Bug c++/103678] New: [concepts] Constrained partial specialization of dependent template conflicts with unconstrained partial specialization matthewjbarichello at gmail dot com
  2021-12-13  9:40 ` [Bug c++/103678] " redi at gcc dot gnu.org
@ 2022-01-27 16:02 ` cvs-commit at gcc dot gnu.org
  2022-01-27 16:04 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-01-27 16:02 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 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:ce6054a22ae14594a2919d2ad87cd9478e616fb3

commit r12-6896-gce6054a22ae14594a2919d2ad87cd9478e616fb3
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Jan 27 10:56:34 2022 -0500

    c++: constrained partial spec using qualified name [PR92944, PR103678]

    In the nested_name_specifier branch within cp_parser_class_head, we need
    to update 'type' with the result of maybe_process_partial_specialization
    like we do in the template_id_p branch.

            PR c++/92944
            PR c++/103678

    gcc/cp/ChangeLog:

            * parser.cc (cp_parser_class_head): Update 'type' with the result
            of maybe_process_partial_specialization in the
            nested_name_specifier branch.  Refactor nearby code to accomodate
            that maybe_process_partial_specialization returns a _TYPE, not a
            TYPE_DECL, and eliminate local variable 'class_type' in passing.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-partial-spec10.C: New test.
            * g++.dg/cpp2a/concepts-partial-spec11.C: New test.

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

* [Bug c++/103678] [concepts] Constrained partial specialization of dependent template conflicts with unconstrained partial specialization
  2021-12-13  1:54 [Bug c++/103678] New: [concepts] Constrained partial specialization of dependent template conflicts with unconstrained partial specialization matthewjbarichello at gmail dot com
  2021-12-13  9:40 ` [Bug c++/103678] " redi at gcc dot gnu.org
  2022-01-27 16:02 ` cvs-commit at gcc dot gnu.org
@ 2022-01-27 16:04 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2022-01-27 16:04 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |12.0

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 12, thanks for the bug report.

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

end of thread, other threads:[~2022-01-27 16:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-13  1:54 [Bug c++/103678] New: [concepts] Constrained partial specialization of dependent template conflicts with unconstrained partial specialization matthewjbarichello at gmail dot com
2021-12-13  9:40 ` [Bug c++/103678] " redi at gcc dot gnu.org
2022-01-27 16:02 ` cvs-commit at gcc dot gnu.org
2022-01-27 16:04 ` 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).