I'm trying to call operator() on a temporary object with deduced type, but clang rejects my code while gcc accepts it.
Clang complains about a missing unqualified-id, but my intention is to create a temporary and call operator(), not to not declare an object.
template<typename T>
struct Wrapper {
Wrapper(T) {}
void operator()() { }
};
template<typename T>
Wrapper(T) -> Wrapper<T>;
int main() {
// works in gcc, not in clang
Wrapper{int{}}();
// works with both
// Wrapper a{int{}}; a();
}
I wasn't able to find anything in the standard that explains this behavior, but I might be missing something. So my question is: Is clang is right here or is gcc?
Aucun commentaire:
Enregistrer un commentaire