CTAD on variable with parenthesized initializer · Issue #39811 · llvm/llvm-project (original) (raw)

Bugzilla Link 40465
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @zygoloid

Extended Description

template <typename = void> struct Foo {};

int main() { Foo f; // everyone accepts Foo (g); // clang rejects // gcc accepts, edg accepts, msvc accepts }

clang says:

error: cannot use parentheses when declaring variable with deduced class template specialization type

This seems to be a highly specific error message but I can't see why this would be disallowed. [dcl.type.class.deduct] seems to allow g, but again since the message is so specific, I don't know. The other three compilers accept the code.