llvm-project/clang/test/Parser/friend-concept.cpp
Sirraide 8b5f606612
[Clang] [Parser] Improve diagnostic for friend concept (#105121)
Diagnose this early after parsing declaration specifiers; this allows us
to issue a better diagnostic. This also checks for `concept friend` and
concept declarations w/o a template-head because it’s easiest to do that
at the same time.

Fixes #45182.
2024-08-22 23:33:40 +02:00

14 lines
710 B
C++

// RUN: %clang_cc1 -fsyntax-only -verify -std=c++20 %s
template<class>
concept fooable = true;
struct S {
template<class> friend concept x = requires { requires true; }; // expected-error {{friend declaration cannot be a concept}}
template<class> friend concept fooable; // expected-error {{friend declaration cannot be a concept}}
template<class> concept friend fooable; // expected-error {{expected unqualified-id}}
friend concept fooable; // expected-error {{friend declaration cannot be a concept}}
concept friend fooable; // expected-error {{friend declaration cannot be a concept}}
concept fooable; // expected-error {{concept declarations may only appear in global or namespace scope}}
};