public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109061] New: GCC try to eagerly instantiate more than needed
@ 2023-03-08 1:37 fsb4000 at yandex dot ru
2023-03-08 1:53 ` [Bug c++/109061] " fsb4000 at yandex dot ru
0 siblings, 1 reply; 2+ messages in thread
From: fsb4000 at yandex dot ru @ 2023-03-08 1:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109061
Bug ID: 109061
Summary: GCC try to eagerly instantiate more than needed
Product: gcc
Version: 12.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fsb4000 at yandex dot ru
Target Milestone: ---
While submitting a libc++ patch about adding `static_assert` to `std::declval`:
https://reviews.llvm.org/D145376
I got an opinion from a compiler frontend dev that the patch is incorrect
because it broke the code:
template <class T, class U, class = U[std::declval<T>()]>
constexpr bool xxx(int) { return true; }
template <class T, class U>
constexpr bool xxx(long) { return false; }
constexpr bool y = xxx<long long, int>(0);
I believe that my patch is correct and libstdc++ and MSVC STL has the similar
implementations with `static_assert`.
I checked GCC 12.2.0 behaviour and found that it also doesn't work with that
example:
https://gcc.godbolt.org/z/MssGMMqsd
And because I believe that the library implementations are correct I create a
bug against C++ and not libstdc++
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/109061] GCC try to eagerly instantiate more than needed
2023-03-08 1:37 [Bug c++/109061] New: GCC try to eagerly instantiate more than needed fsb4000 at yandex dot ru
@ 2023-03-08 1:53 ` fsb4000 at yandex dot ru
0 siblings, 0 replies; 2+ messages in thread
From: fsb4000 at yandex dot ru @ 2023-03-08 1:53 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109061
--- Comment #1 from fsb4000 at yandex dot ru ---
Actually, I'm not sure. Maybe GCC does correct things and the person wrongly
thinks that the code should work...
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-03-08 1:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-08 1:37 [Bug c++/109061] New: GCC try to eagerly instantiate more than needed fsb4000 at yandex dot ru
2023-03-08 1:53 ` [Bug c++/109061] " fsb4000 at yandex dot ru
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).