public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/88804] Inconsistently diagnosed unused but set static variable in lambda
[not found] <bug-88804-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-17 9:01 ` pinskia at gcc dot gnu.org
2022-09-23 16:18 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-17 9:01 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88804
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bisqwit at iki dot fi
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 94575 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/88804] Inconsistently diagnosed unused but set static variable in lambda
[not found] <bug-88804-4@http.gcc.gnu.org/bugzilla/>
2021-08-17 9:01 ` [Bug c++/88804] Inconsistently diagnosed unused but set static variable in lambda pinskia at gcc dot gnu.org
@ 2022-09-23 16:18 ` pinskia at gcc dot gnu.org
2022-09-23 16:22 ` [Bug c++/88804] incorrect unused but set static variable in templated lambda pinskia at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-09-23 16:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88804
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mario at klebsch dot de
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 107019 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/88804] incorrect unused but set static variable in templated lambda
[not found] <bug-88804-4@http.gcc.gnu.org/bugzilla/>
2021-08-17 9:01 ` [Bug c++/88804] Inconsistently diagnosed unused but set static variable in lambda pinskia at gcc dot gnu.org
2022-09-23 16:18 ` pinskia at gcc dot gnu.org
@ 2022-09-23 16:22 ` pinskia at gcc dot gnu.org
2022-09-23 16:25 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-09-23 16:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88804
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Inconsistently diagnosed |incorrect unused but set
|unused but set static |static variable in
|variable in lambda |templated lambda
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Another example where the warning happens but should not:
void foo(int);
template <class T> void call(T t) {
t(0);
}
void bar() {
static int x=3;
call([]<typename t>(t){
foo(x);
});
}
Basically the templated lambda is causing the static variable not be marked ...
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/88804] incorrect unused but set static variable in templated lambda
[not found] <bug-88804-4@http.gcc.gnu.org/bugzilla/>
` (2 preceding siblings ...)
2022-09-23 16:22 ` [Bug c++/88804] incorrect unused but set static variable in templated lambda pinskia at gcc dot gnu.org
@ 2022-09-23 16:25 ` pinskia at gcc dot gnu.org
2022-09-23 16:27 ` pinskia at gcc dot gnu.org
2023-04-26 12:46 ` fiesh at zefix dot tv
5 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-09-23 16:25 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88804
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |cuzdav at gmail dot com
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 105571 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/88804] incorrect unused but set static variable in templated lambda
[not found] <bug-88804-4@http.gcc.gnu.org/bugzilla/>
` (3 preceding siblings ...)
2022-09-23 16:25 ` pinskia at gcc dot gnu.org
@ 2022-09-23 16:27 ` pinskia at gcc dot gnu.org
2023-04-26 12:46 ` fiesh at zefix dot tv
5 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-09-23 16:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88804
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gccbugbjorn at fahller dot se
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 96400 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/88804] incorrect unused but set static variable in templated lambda
[not found] <bug-88804-4@http.gcc.gnu.org/bugzilla/>
` (4 preceding siblings ...)
2022-09-23 16:27 ` pinskia at gcc dot gnu.org
@ 2023-04-26 12:46 ` fiesh at zefix dot tv
5 siblings, 0 replies; 6+ messages in thread
From: fiesh at zefix dot tv @ 2023-04-26 12:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88804
fiesh at zefix dot tv changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fiesh at zefix dot tv
--- Comment #7 from fiesh at zefix dot tv ---
I suppose this snippet also exhibits this bug here?
template <int... Is> struct IntegerSequence {};
template <int i> struct IntegralConstant {
constexpr auto operator()() const { return i; }
};
template <typename F, typename IndexType, IndexType... index>
constexpr void apply(F const &f, IntegerSequence<index...>) {
(f(IntegralConstant<index>{}), ...);
}
template <auto size, typename F> constexpr void constexpr_foreach(F const &f) {
apply<F, int>(f, IntegerSequence<0>{});
}
int main() {
static int i[1] = {42};
int j{};
constexpr_foreach<1>([&j](auto const index) { j += i[index()]; });
return j;
}
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-04-26 12:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-88804-4@http.gcc.gnu.org/bugzilla/>
2021-08-17 9:01 ` [Bug c++/88804] Inconsistently diagnosed unused but set static variable in lambda pinskia at gcc dot gnu.org
2022-09-23 16:18 ` pinskia at gcc dot gnu.org
2022-09-23 16:22 ` [Bug c++/88804] incorrect unused but set static variable in templated lambda pinskia at gcc dot gnu.org
2022-09-23 16:25 ` pinskia at gcc dot gnu.org
2022-09-23 16:27 ` pinskia at gcc dot gnu.org
2023-04-26 12:46 ` fiesh at zefix dot tv
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).