Skip to content

[Clang] Invalid diagnostic when checking trailing requires of inherited ctor #62361

Closed
@alimpfard

Description

Bisected to aeee4eb, present in main (7090c10).

Reduced test case:

template <typename T, typename U> inline constexpr bool IsSame = false;
template <typename T> inline constexpr bool IsSame<T, T> = true;

struct Empty {};
struct X {};

template <typename T, typename E = X> struct Test {
  Test()
    requires(IsSame<T, Empty>);
};

template <typename XType>
struct Test<void, XType> : public Test<Empty, XType> {
  using Test<Empty, XType>::Test;
};

void foo() {
    Test<void>();
}

Accepted before aeee4eb, error since:

test.cpp:18:5: error: invalid reference to function 'Test': constraints not satisfied
    Test<void>();
    ^
test.cpp:9:14: note: because 'IsSame<X, Empty>' evaluated to false
    requires(IsSame<T, Empty>);
             ^

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    c++20clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerconfirmedVerified by a second party

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions