67c665c introduces the possibility of constraining the wildcarded type with concepts. It works correctly for concepts taking one argument but fail for concepts taking two (or more) arguments.
E.g. for the following code:
fun: (x: _ is std::convertible_to<bool>) = {
if x {
std::cout << "true" << std::endl;
} else {
std::cout << "false" << std::endl;
}
}
main: () = {
fun(true);
}
cppfront generates the following code (clean-cpp1 version):
#include "cpp2util.h"
auto fun(auto const& x) -> void
CPP2_REQUIRES (std::convertible_to<bool><CPP2_TYPEOF(x)>) ;
auto main() -> int;
auto fun(auto const& x) -> void
requires (std::convertible_to<bool><CPP2_TYPEOF(x)>) {
if (x) {
std::cout << "true" << std::endl;
}else {
std::cout << "false" << std::endl;
}
}
auto main() -> int{
fun(true);
}
The bug is in the generated require clause, which is generated in the following way:
requires (std::convertible_to<bool><CPP2_TYPEOF(x)>) {
And it should be generated in the following way:
requires (std::convertible_to<CPP2_TYPEOF(x), bool>) {Reactions are currently unavailable
67c665c introduces the possibility of constraining the wildcarded type with concepts. It works correctly for concepts taking one argument but fail for concepts taking two (or more) arguments.
E.g. for the following code:
cppfront generates the following code (clean-cpp1 version):
The bug is in the generated require clause, which is generated in the following way:
And it should be generated in the following way: