gcc的感觉可以,msvc的不太好
happy@UOS-128G:~$ /opt/cross/bin/x86_64-linux-musl-g++ -static -std=c++20 1.cpp
1.cpp: In function ‘auto [requires ::IsBoolean<<placeholder>, >] myFunction()’:
1.cpp:11:12: error: deduced return type does not satisfy placeholder constraints
11 | return 1;
| ^
1.cpp:11:12: note: constraints not satisfied
1.cpp:6:9: required for the satisfaction of ‘IsBoolean<auto [requires ::IsBoolean<<placeholder>, >]>’ [with auto [requires ::IsBoolean<<placeholder>, >] = int]
1.cpp:6:26: note: the expression ‘is_same_v<T, bool> [with T = int]’ evaluated to ‘false’
6 | concept IsBoolean = std::is_same_v<T, bool>;
| ~~~~~^~~~~~~~~~~~~~~~~~
【 在 ziqin 的大作中提到: 】
: 主要还是想通过static_assert加一些用户报错信息
: concept的报错信息有时候还是不太好读
:
--
FROM 61.48.130.*