public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/102925] New: [11.2]ICE with concept of std::convertible_to with lambda in unevaluated-context @ 2021-10-25 10:11 nickhuang99 at hotmail dot com 2021-10-25 12:40 ` [Bug c++/102925] " pinskia at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: nickhuang99 at hotmail dot com @ 2021-10-25 10:11 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102925 Bug ID: 102925 Summary: [11.2]ICE with concept of std::convertible_to with lambda in unevaluated-context Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: nickhuang99 at hotmail dot com Target Milestone: --- The following code causes ICE in 11.2 when clang and MSVC++ all work fine. (https://www.godbolt.org/z/eGq118ohT) This ICE is fixed in trunk with a different issue of no matching template declaration for template specialization. #include <concepts> template<class T> concept IsLambda=std::convertible_to<T,decltype(+[]{})>; template<IsLambda T> void foo(T t){ t();} template<> void foo<decltype(+[]{})>(decltype(+[]{}) t){ t(); } <source>:10:6: error: template-id 'foo<void (*)()>' for 'void foo(void (*)())' does not match any template declaration 10 | void foo<decltype(+[]{})>(decltype(+[]{}) t){ | ^~~~~~~~~~~~~~~~~~~~ <source>:7:6: note: candidate is: 'template<class T> requires IsLambda<T> void foo(T)' 7 | void foo(T t){ t();} | ^~~ Compiler returned: 1 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/102925] [11.2]ICE with concept of std::convertible_to with lambda in unevaluated-context 2021-10-25 10:11 [Bug c++/102925] New: [11.2]ICE with concept of std::convertible_to with lambda in unevaluated-context nickhuang99 at hotmail dot com @ 2021-10-25 12:40 ` pinskia at gcc dot gnu.org 2021-10-25 15:12 ` nickhuang99 at hotmail dot com 2024-04-13 7:58 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2021-10-25 12:40 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102925 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |102728 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- PR 102728 is for the rejects valid. Referenced Bugs: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102728 [Bug 102728] requires statement fails to recognize lambda in unevaluated context ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/102925] [11.2]ICE with concept of std::convertible_to with lambda in unevaluated-context 2021-10-25 10:11 [Bug c++/102925] New: [11.2]ICE with concept of std::convertible_to with lambda in unevaluated-context nickhuang99 at hotmail dot com 2021-10-25 12:40 ` [Bug c++/102925] " pinskia at gcc dot gnu.org @ 2021-10-25 15:12 ` nickhuang99 at hotmail dot com 2024-04-13 7:58 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: nickhuang99 at hotmail dot com @ 2021-10-25 15:12 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102925 --- Comment #2 from qingzhe huang <nickhuang99 at hotmail dot com> --- I suspect this is related to template-specialization-related issue because if I use original implementation of "std::convertible_to" to declare my concept (https://en.cppreference.com/w/cpp/concepts/convertible_to), template <class From, class To> concept convertible_to = std::is_convertible_v<From, To> && requires { static_cast<To>(std::declval<From>()); }; then it works. (https://www.godbolt.org/z/99eoToze3) See this concept is not a specialization of concept "std::convertible_to" template<class T> concept IsLambda=std::is_convertible_v<T,decltype(+[]{})> && requires{ static_cast<decltype(+[]{})>(std::declval<T>()); }; ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/102925] [11.2]ICE with concept of std::convertible_to with lambda in unevaluated-context 2021-10-25 10:11 [Bug c++/102925] New: [11.2]ICE with concept of std::convertible_to with lambda in unevaluated-context nickhuang99 at hotmail dot com 2021-10-25 12:40 ` [Bug c++/102925] " pinskia at gcc dot gnu.org 2021-10-25 15:12 ` nickhuang99 at hotmail dot com @ 2024-04-13 7:58 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-04-13 7:58 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102925 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED Target Milestone|--- |13.0 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Was fixed in GCC 13. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-04-13 7:58 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-10-25 10:11 [Bug c++/102925] New: [11.2]ICE with concept of std::convertible_to with lambda in unevaluated-context nickhuang99 at hotmail dot com 2021-10-25 12:40 ` [Bug c++/102925] " pinskia at gcc dot gnu.org 2021-10-25 15:12 ` nickhuang99 at hotmail dot com 2024-04-13 7:58 ` pinskia 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).