public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/81880] thread_local static member template initialisation fails
[not found] <bug-81880-4@http.gcc.gnu.org/bugzilla/>
@ 2020-08-30 17:24 ` tobias.bruell at gmail dot com
2021-08-22 22:32 ` pinskia at gcc dot gnu.org
2023-07-06 21:55 ` ttimo at valvesoftware dot com
2 siblings, 0 replies; 3+ messages in thread
From: tobias.bruell at gmail dot com @ 2020-08-30 17:24 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81880
Toby Brull <tobias.bruell at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tobias.bruell at gmail dot com
--- Comment #3 from Toby Brull <tobias.bruell at gmail dot com> ---
I played around a bit with gcc, and it looks like the example can be made to
work via the following diff:
---------------------------------------
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 639b00264d8..f6b10174f1b 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -3898,6 +3898,8 @@ finish_id_expression_1 (tree id_expression,
decl = finish_template_variable (decl);
mark_used (decl);
decl = convert_from_reference (decl);
+ if (tree wrap = maybe_get_tls_wrapper_call (decl))
+ decl = wrap;
}
else if (concept_check_p (decl))
{
---------------------------------------
Not sure if this makes sense, though, in the greater scheme of things. So I'll
just leave that here FYI.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/81880] thread_local static member template initialisation fails
[not found] <bug-81880-4@http.gcc.gnu.org/bugzilla/>
2020-08-30 17:24 ` [Bug c++/81880] thread_local static member template initialisation fails tobias.bruell at gmail dot com
@ 2021-08-22 22:32 ` pinskia at gcc dot gnu.org
2023-07-06 21:55 ` ttimo at valvesoftware dot com
2 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-22 22:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81880
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
extern "C" void abort(void);
struct tt
{
int *tt1 = new int{1};
int bucket_count() const {return *tt1;}
};
struct A {
template<typename T> thread_local static tt m;
};
template<typename T> thread_local tt A::m{};
int main() {
if ( A::m<int>.bucket_count() != 1) abort();
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/81880] thread_local static member template initialisation fails
[not found] <bug-81880-4@http.gcc.gnu.org/bugzilla/>
2020-08-30 17:24 ` [Bug c++/81880] thread_local static member template initialisation fails tobias.bruell at gmail dot com
2021-08-22 22:32 ` pinskia at gcc dot gnu.org
@ 2023-07-06 21:55 ` ttimo at valvesoftware dot com
2 siblings, 0 replies; 3+ messages in thread
From: ttimo at valvesoftware dot com @ 2023-07-06 21:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81880
Timothee Besset <ttimo at valvesoftware dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ttimo at valvesoftware dot com
--- Comment #5 from Timothee Besset <ttimo at valvesoftware dot com> ---
we are observing this with gcc 10.3.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-07-06 21:55 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-81880-4@http.gcc.gnu.org/bugzilla/>
2020-08-30 17:24 ` [Bug c++/81880] thread_local static member template initialisation fails tobias.bruell at gmail dot com
2021-08-22 22:32 ` pinskia at gcc dot gnu.org
2023-07-06 21:55 ` ttimo at valvesoftware dot com
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).