Skip to content

Should reject a requires-clause attached to a non-template function #51173

@llvmbot

Description

@llvmbot
Bugzilla Link 51831
Version 12.0
OS Windows NT
Reporter LLVM Bugzilla Contributor
CC @zygoloid

Extended Description

Wrong code as follows is accepted by Clang:

#include <iostream>

template<> //#1
void foo(auto x) { std::cout << x; };

template<> //#2
void foo(int) requires(false) { std::cout << "int"; };

int main() { foo(1); }

In #​1, we have a template specialization, while no template function was defined before.
In #​2 we have requires-clause for not-template function.

Both #​1 and #​2 must be rejected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++20clang:frontendLanguage frontend issues, e.g. anything involving "Sema"conceptsC++20 conceptsconfirmedVerified by a second party

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions