public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/115283] New: [14 Regression] "used but never defined" with extern templates
@ 2024-05-29 21:36 gcc at hazardy dot de
2024-05-29 21:56 ` [Bug c++/115283] " mpolacek at gcc dot gnu.org
` (7 more replies)
0 siblings, 8 replies; 9+ messages in thread
From: gcc at hazardy dot de @ 2024-05-29 21:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115283
Bug ID: 115283
Summary: [14 Regression] "used but never defined" with extern
templates
Product: gcc
Version: 14.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gcc at hazardy dot de
Target Milestone: ---
This reduced code does work with GCC 13, but with 14 I get the "used but never
defined" warning (and later undefined refernces, even tho the symbols are
emitted to the object files).
See https://godbolt.org/z/Gsz4x7d6h
#include <concepts>
#include <type_traits>
template<typename T>
class C
{
public:
using ResultT = std::conditional_t<std::same_as<T, void>, T, T>;
ResultT Result;
C(ResultT result);
};
template<typename T>
C<T>::C(ResultT result)
: Result{result}
{
return;
}
extern template class C<bool>;
void foo()
{
C<bool> r(true);
}
It is absolutely necessary to use the std::same_as for the conditional. If it
is replaced with true (or false) everything works. Even exchanging it with
sizeof(T) >= 2 works. std::is_same_v also works.
So maybe it's a bug in std::same_as?
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115283] [14 Regression] "used but never defined" with extern templates
2024-05-29 21:36 [Bug c++/115283] New: [14 Regression] "used but never defined" with extern templates gcc at hazardy dot de
@ 2024-05-29 21:56 ` mpolacek at gcc dot gnu.org
2024-05-29 22:42 ` [Bug c++/115283] [14/15 " pinskia at gcc dot gnu.org
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-05-29 21:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115283
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r14-6789.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115283] [14/15 Regression] "used but never defined" with extern templates
2024-05-29 21:36 [Bug c++/115283] New: [14 Regression] "used but never defined" with extern templates gcc at hazardy dot de
2024-05-29 21:56 ` [Bug c++/115283] " mpolacek at gcc dot gnu.org
@ 2024-05-29 22:42 ` pinskia at gcc dot gnu.org
2024-05-29 23:03 ` pinskia at gcc dot gnu.org
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-29 22:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115283
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |14.2
Summary|[14 Regression] "used but |[14/15 Regression] "used
|never defined" with extern |but never defined" with
|templates |extern templates
Keywords| |diagnostic
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115283] [14/15 Regression] "used but never defined" with extern templates
2024-05-29 21:36 [Bug c++/115283] New: [14 Regression] "used but never defined" with extern templates gcc at hazardy dot de
2024-05-29 21:56 ` [Bug c++/115283] " mpolacek at gcc dot gnu.org
2024-05-29 22:42 ` [Bug c++/115283] [14/15 " pinskia at gcc dot gnu.org
@ 2024-05-29 23:03 ` pinskia at gcc dot gnu.org
2024-05-29 23:04 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-29 23:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115283
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Created attachment 58311
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=58311&action=edit
Reduced
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115283] [14/15 Regression] "used but never defined" with extern templates
2024-05-29 21:36 [Bug c++/115283] New: [14 Regression] "used but never defined" with extern templates gcc at hazardy dot de
` (2 preceding siblings ...)
2024-05-29 23:03 ` pinskia at gcc dot gnu.org
@ 2024-05-29 23:04 ` pinskia at gcc dot gnu.org
2024-06-13 0:06 ` cvs-commit at gcc dot gnu.org
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-05-29 23:04 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115283
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Last reconfirmed| |2024-05-29
Status|UNCONFIRMED |NEW
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. attached the reduced testcase.
Note concept here for same is important, using `inline constexpr bool` instead
does not cause the warning to happen.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115283] [14/15 Regression] "used but never defined" with extern templates
2024-05-29 21:36 [Bug c++/115283] New: [14 Regression] "used but never defined" with extern templates gcc at hazardy dot de
` (3 preceding siblings ...)
2024-05-29 23:04 ` pinskia at gcc dot gnu.org
@ 2024-06-13 0:06 ` cvs-commit at gcc dot gnu.org
2024-06-13 2:20 ` [Bug c++/115283] [14 " ppalka at gcc dot gnu.org
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-13 0:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115283
--- Comment #4 from GCC 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:b1fe718cbe0c8883af89f52e0aad3ebf913683de
commit r15-1227-gb1fe718cbe0c8883af89f52e0aad3ebf913683de
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Jun 12 20:05:05 2024 -0400
c++: visibility wrt concept-id as targ [PR115283]
Like with alias templates, it seems we don't maintain visibility flags
for concepts either, so min_vis_expr_r should ignore them for now.
Otherwise after r14-6789 we may incorrectly give a function template that
uses a concept-id in its signature internal linkage.
PR c++/115283
gcc/cp/ChangeLog:
* decl2.cc (min_vis_expr_r) <case TEMPLATE_DECL>: Ignore
concepts.
gcc/testsuite/ChangeLog:
* g++.dg/template/linkage5.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115283] [14 Regression] "used but never defined" with extern templates
2024-05-29 21:36 [Bug c++/115283] New: [14 Regression] "used but never defined" with extern templates gcc at hazardy dot de
` (4 preceding siblings ...)
2024-06-13 0:06 ` cvs-commit at gcc dot gnu.org
@ 2024-06-13 2:20 ` ppalka at gcc dot gnu.org
2024-06-17 14:26 ` cvs-commit at gcc dot gnu.org
2024-06-17 14:26 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-06-13 2:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115283
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|[14/15 Regression] "used |[14 Regression] "used but
|but never defined" with |never defined" with extern
|extern templates |templates
Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org
Keywords| |link-failure
Status|NEW |ASSIGNED
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115283] [14 Regression] "used but never defined" with extern templates
2024-05-29 21:36 [Bug c++/115283] New: [14 Regression] "used but never defined" with extern templates gcc at hazardy dot de
` (5 preceding siblings ...)
2024-06-13 2:20 ` [Bug c++/115283] [14 " ppalka at gcc dot gnu.org
@ 2024-06-17 14:26 ` cvs-commit at gcc dot gnu.org
2024-06-17 14:26 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-06-17 14:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115283
--- Comment #5 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-14 branch has been updated by Patrick Palka
<ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:9583f781e17d4da881ee64db43af939402331413
commit r14-10318-g9583f781e17d4da881ee64db43af939402331413
Author: Patrick Palka <ppalka@redhat.com>
Date: Wed Jun 12 20:05:05 2024 -0400
c++: visibility wrt concept-id as targ [PR115283]
Like with alias templates, it seems we don't maintain visibility flags
for concepts either, so min_vis_expr_r should ignore them for now.
Otherwise after r14-6789 we may incorrectly give a function template that
uses a concept-id in its signature internal linkage.
PR c++/115283
gcc/cp/ChangeLog:
* decl2.cc (min_vis_expr_r) <case TEMPLATE_DECL>: Ignore
concepts.
gcc/testsuite/ChangeLog:
* g++.dg/template/linkage5.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
(cherry picked from commit b1fe718cbe0c8883af89f52e0aad3ebf913683de)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/115283] [14 Regression] "used but never defined" with extern templates
2024-05-29 21:36 [Bug c++/115283] New: [14 Regression] "used but never defined" with extern templates gcc at hazardy dot de
` (6 preceding siblings ...)
2024-06-17 14:26 ` cvs-commit at gcc dot gnu.org
@ 2024-06-17 14:26 ` ppalka at gcc dot gnu.org
7 siblings, 0 replies; 9+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-06-17 14:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115283
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution|--- |FIXED
--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed for GCC 14.2, thanks for the bug report.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-06-17 14:26 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-29 21:36 [Bug c++/115283] New: [14 Regression] "used but never defined" with extern templates gcc at hazardy dot de
2024-05-29 21:56 ` [Bug c++/115283] " mpolacek at gcc dot gnu.org
2024-05-29 22:42 ` [Bug c++/115283] [14/15 " pinskia at gcc dot gnu.org
2024-05-29 23:03 ` pinskia at gcc dot gnu.org
2024-05-29 23:04 ` pinskia at gcc dot gnu.org
2024-06-13 0:06 ` cvs-commit at gcc dot gnu.org
2024-06-13 2:20 ` [Bug c++/115283] [14 " ppalka at gcc dot gnu.org
2024-06-17 14:26 ` cvs-commit at gcc dot gnu.org
2024-06-17 14:26 ` 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).