[Bug c++/104634] Explicit template instantiation does not work when there are multiple partial template specialization using concepts

2024-01-15 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104634

Patrick Palka  changed:

   What|Removed |Added

 Resolution|--- |FIXED
 Status|ASSIGNED|RESOLVED

--- Comment #6 from Patrick Palka  ---
Fixed for GCC 13.3 and 14, thanks for the bug report.

[Bug c++/104634] Explicit template instantiation does not work when there are multiple partial template specialization using concepts

2024-01-15 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104634

--- Comment #5 from GCC Commits  ---
The releases/gcc-13 branch has been updated by Patrick Palka
:

https://gcc.gnu.org/g:854c9b682562b103f60e5f0a823f31df17a97568

commit r13-8225-g854c9b682562b103f60e5f0a823f31df17a97568
Author: Patrick Palka 
Date:   Mon Jan 15 16:53:28 2024 -0500

c++: explicit inst w/ similar constrained partial specs [PR104634]

Here we neglect to emit the definitions of A::f2 and A::f4
despite the explicit instantiations ultimately because TREE_PUBLIC isn't
set on the corresponding partial specializations, whose declarations are
created from maybe_new_partial_specialization which is responsible for
disambiguating them from the first and third partial specializations (which
have the same class-head but different constraints).  This makes grokfndecl
in turn clear TREE_PUBLIC for f2 and f4 as if they have internal linkage.

This patch fixes this by setting TREE_PUBLIC appropriately for such partial
specializations.

PR c++/104634

gcc/cp/ChangeLog:

* pt.cc (maybe_new_partial_specialization): Propagate TREE_PUBLIC
to the newly created partial specialization.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-explicit-inst6.C: New test.

Reviewed-by: Jason Merrill 
(cherry picked from commit 47673571b28278d857371167f4b67a04a1b87b59)

[Bug c++/104634] Explicit template instantiation does not work when there are multiple partial template specialization using concepts

2024-01-15 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104634

--- Comment #3 from GCC Commits  ---
The master branch has been updated by Patrick Palka :

https://gcc.gnu.org/g:47673571b28278d857371167f4b67a04a1b87b59

commit r14-7261-g47673571b28278d857371167f4b67a04a1b87b59
Author: Patrick Palka 
Date:   Mon Jan 15 16:53:28 2024 -0500

c++: explicit inst w/ similar constrained partial specs [PR104634]

Here we neglect to emit the definitions of A::f2 and A::f4
despite the explicit instantiations ultimately because TREE_PUBLIC isn't
set on the corresponding partial specializations, whose declarations are
created from maybe_new_partial_specialization which is responsible for
disambiguating them from the first and third partial specializations (which
have the same class-head but different constraints).  This makes grokfndecl
in turn clear TREE_PUBLIC for f2 and f4 as if they have internal linkage.

This patch fixes this by setting TREE_PUBLIC appropriately for such partial
specializations.

PR c++/104634

gcc/cp/ChangeLog:

* pt.cc (maybe_new_partial_specialization): Propagate TREE_PUBLIC
to the newly created partial specialization.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-explicit-inst6.C: New test.

Reviewed-by: Jason Merrill 

[Bug c++/104634] Explicit template instantiation does not work when there are multiple partial template specialization using concepts

2024-01-15 Thread ppalka at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104634

Patrick Palka  changed:

   What|Removed |Added

   Assignee|unassigned at gcc dot gnu.org  |ppalka at gcc dot 
gnu.org
 Status|NEW |ASSIGNED
   Target Milestone|--- |13.3

--- Comment #4 from Patrick Palka  ---
Fixed on trunk so far.

[Bug c++/104634] Explicit template instantiation does not work when there are multiple partial template specialization using concepts

2023-12-14 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104634

Andrew Pinski  changed:

   What|Removed |Added

 CC||adrian at woeltche dot de

--- Comment #2 from Andrew Pinski  ---
*** Bug 113020 has been marked as a duplicate of this bug. ***

[Bug c++/104634] Explicit template instantiation does not work when there are multiple partial template specialization using concepts

2022-02-22 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104634

Andrew Pinski  changed:

   What|Removed |Added

 Ever confirmed|0   |1
   Keywords||link-failure
   Last reconfirmed||2022-02-22
 Status|UNCONFIRMED |NEW

--- Comment #1 from Andrew Pinski  ---
Confirmed,
template 
constexpr bool type_same = false;

template
constexpr bool type_same = true;

template 
concept same_as = type_same;

template
struct Struct {
static void func1(){}
};

template T>
struct Struct {
static void func3() {}
};

template T>
struct Struct {
static void func2() {}
};

template struct Struct;
template struct Struct;

- CUT 
The function is in .original so maybe it is not being marked as used