Skip to content

Class explicit-instantiation-definition tries to instantiate member functions disabled with requires #52625

@HolyBlackCat

Description

@HolyBlackCat

When explicitly instantiating a class, Clang tries to instantiate all member functions, even those that should be disabled with requires. Example:

template <typename T>
struct A
{
    void foo() requires requires{ T::bar(); }
    {
        T::bar();
    }
};

template struct A<int>;

This should compile, but doesn't:

<source>:6:9: error: type 'int' cannot be used prior to '::' because it has no members
        T::bar();
        ^
<source>:10:17: note: in instantiation of member function 'A<int>::foo' requested here
template struct A<int>;
                ^

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:frontendLanguage frontend issues, e.g. anything involving "Sema"duplicateResolved as duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions