Skip to content

Defining constrained member function out of line is rejected #47364

@llvmbot

Description

@llvmbot
Bugzilla Link 48020
Version trunk
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @CaseyCarter,@zygoloid

Extended Description

From StackOverflow (https://stackoverflow.com/q/64601583/2069064):

template <typename> concept C = true;

template <typename T>
struct Foo { };

template<typename T>
    requires C<T>
struct Foo<T> {
    static void bar();
};

template<typename T>
    requires C<T>
void Foo<T>::bar() { }

int main() {
    Foo<int>::bar();
}

clang 11 rejects this program with:

<source>:13:10: error: requires clause differs in template redeclaration
requires C<T>
         ^
<source>:3:1: note: previous template declaration is here
template <typename T>
^

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"conceptsC++20 concepts

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions