Closed BillyDonahue closed 1 year ago
This definitely looks like a compiler bug to me, can you please report against Clang?
Here's a reduced reproducer: https://godbolt.org/z/d4hMevrPo
int main() {
// OK
[](auto) {
[](int) {
struct tmp {
static constexpr auto get() { return "xxx"; }
};
}(2);
}(1);
// NOT OK
[](auto) {
[](auto) {
struct tmp {
static constexpr auto get() { return "xxx"; }
};
}(2);
}(1);
}
Clang chokes when
BOOST_HANA_STRING
is enclosed by 2 layers of polymorphic lambdas.cannot initialize return object of type 'decltype(auto)' with an lvalue of type 'const char [4]'
Tested with Boost-1.75.0, Clang-11.0.1, MacOS & CompilerExplorer. GCC not affected. https://gcc.godbolt.org/z/6WsY7e
If either of the lambdas is not polymorphic, there's no problem.
https://raw.githubusercontent.com/BillyDonahue/experimental/hana_repro/per_file_template/hana_string_repro.cpp