#include <iostream>
#include <initializer_list>
using namespace std;
struct AddInitializerList {
void operator+= (initializer_list<int> values) {
// Do nothing
}
void operator+ (initializer_list<int> values) {
// Do nothing
}
};
int main() {
AddInitializerList adder;
adder += {1, 2, 3}; // Totally legit
adder + {1, 2, 3}; // Not okay!
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8aW5pdGlhbGl6ZXJfbGlzdD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCnN0cnVjdCBBZGRJbml0aWFsaXplckxpc3QgewoJdm9pZCBvcGVyYXRvcis9IChpbml0aWFsaXplcl9saXN0PGludD4gdmFsdWVzKSB7CgkJLy8gRG8gbm90aGluZwkKCX0KCQoJdm9pZCBvcGVyYXRvcisgKGluaXRpYWxpemVyX2xpc3Q8aW50PiB2YWx1ZXMpIHsKCQkvLyBEbyBub3RoaW5nCgl9Cn07CgppbnQgbWFpbigpIHsKCUFkZEluaXRpYWxpemVyTGlzdCBhZGRlcjsKCWFkZGVyICs9IHsxLCAyLCAzfTsgIC8vIFRvdGFsbHkgbGVnaXQKCWFkZGVyICsgIHsxLCAyLCAzfTsgIC8vIE5vdCBva2F5IQoJCglyZXR1cm4gMDsKfQ==
prog.cpp: In function ‘int main()’:
prog.cpp:18:11: error: expected primary-expression before ‘{’ token
adder + {1, 2, 3}; // Not okay!
^