Skip to content

CTAD on variable with parenthesized initializer #39811

Closed
@llvmbot

Description

@llvmbot
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++17clang:frontendLanguage frontend issues, e.g. anything involving "Sema"questionA question, not bug report. Check out https://llvm.org/docs/GettingInvolved.html instead!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions