#include <stdio.h>
#include <initializer_list>
struct A{
int x;
A():x(0){}
void operator=(std::initializer_list<int> a){printf("int[%lld]:",a.size());for (auto x:a) printf(" %d",x); printf("\n");}
void operator=(float a){printf("float: %.1f\n",a);}
};
struct B:A{
template <typename T>
void operator=(T x){
A::operator=(x);
}
};
int main() {
A a;
a={1,2,5};
a=5.6;
B b;
b={1,5,6};
b=4.7;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxpbml0aWFsaXplcl9saXN0PgoKc3RydWN0IEF7CglpbnQgeDsKCUEoKTp4KDApe30KCXZvaWQgb3BlcmF0b3I9KHN0ZDo6aW5pdGlhbGl6ZXJfbGlzdDxpbnQ+IGEpe3ByaW50ZigiaW50WyVsbGRdOiIsYS5zaXplKCkpO2ZvciAoYXV0byB4OmEpIHByaW50ZigiICVkIix4KTsgcHJpbnRmKCJcbiIpO30KCXZvaWQgb3BlcmF0b3I9KGZsb2F0IGEpe3ByaW50ZigiZmxvYXQ6ICUuMWZcbiIsYSk7fQp9OwoKc3RydWN0IEI6QXsKCXRlbXBsYXRlIDx0eXBlbmFtZSBUPgoJdm9pZCBvcGVyYXRvcj0oVCB4KXsKCQlBOjpvcGVyYXRvcj0oeCk7Cgl9Cn07CgoKCmludCBtYWluKCkgewoKCUEgYTsKCWE9ezEsMiw1fTsKCWE9NS42OwoKCUIgYjsKCWI9ezEsNSw2fTsKCWI9NC43OwoKfQo=
prog.cpp:7:67: warning: format specifies type 'long long' but the argument has type 'std::initializer_list::size_type' (aka 'unsigned long') [-Wformat]
void operator=(std::initializer_list<int> a){printf("int[%lld]:",a.size());for (auto x:a) printf(" %d",x); printf("\n");}
~~~~ ^~~~~~~~
%zu
prog.cpp:27:3: error: no viable overloaded '='
b={1,5,6};
~^~~~~~~~
prog.cpp:11:8: note: candidate function (the implicit copy assignment operator) not viable: cannot convert initializer list argument to 'const B'
struct B:A{
^
prog.cpp:11:8: note: candidate function (the implicit move assignment operator) not viable: cannot convert initializer list argument to 'B'
struct B:A{
^
prog.cpp:13:7: note: candidate template ignored: couldn't infer template argument 'T'
void operator=(T x){
^
1 warning and 1 error generated.