Skip to content

Instantiation of class template causes instantiation of static data member's definition #81191

Open
@BobBugs

Description

@BobBugs

According to C++20 [temp.inst]/3.1 the definition of static data member i should not be instantiated, and therefore the program must compile:

template <class T>
class C {
    static const int i = T::value;
};

C<void> x;

Clang 17.0.1 instantiates it, and compilation fails. Demo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"rejects-valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions