Describe the bug
feff640 added braces around the RHS of assignment in emitted assignment operators. This prevents deduction when the invoked assignment operator is a template, as a braced-init-list has no type.
To Reproduce
Steps to reproduce the behavior:
- Sample code
t1: type = {
operator=: (out this, x) = {}
}
t2: type = {
m: t1;
operator=: (out this, a) = {
m = a;
}
}
main: () = {
x: t2 = 0;
x = 0;
}
- Command lines including which C++ compiler you are using
~/root/bin/cppfront x.cpp2
~/root/clang/bin/clang++ -std=c++20 -I $CPPFRONT_INCLUDE_DIR x.cpp
- Expected result - what you expected to happen
What happened before feff640.
- Actual result/error
x.cpp2:8:7: error: no viable overloaded '='
m = {a};
~ ^ ~~~
x.cpp2:14:5: note: in instantiation of function template specialization 't2::operator=<int>' requested here
x = 0;
^
x.cpp2:2:12: note: candidate template ignored: couldn't infer template argument 'x:auto'
auto t1::operator=(auto const& x) -> t1& {
^
x.cpp2:1:7: note: candidate function (the implicit copy assignment operator) not viable: cannot convert initializer list argument to 'const t1'
class t1 {
^
x.cpp2:1:7: note: candidate function (the implicit move assignment operator) not viable: cannot convert initializer list argument to 't1'
class t1 {
^
1 error generated.
Describe the bug
feff640 added braces around the RHS of assignment in emitted assignment operators. This prevents deduction when the invoked assignment operator is a template, as a braced-init-list has no type.
To Reproduce
Steps to reproduce the behavior:
What happened before feff640.