mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-26 17:56:05 +00:00

The standard says: The optional requires-clause ([temp.pre]) in an init-declarator or member-declarator shall be present only if the declarator declares a templated function ([dcl.fct]). This implements that limitation, and updates the tests to the best of my ability to capture the intent of the original checks. Differential Revision: https://reviews.llvm.org/D125711
16 lines
685 B
C++
16 lines
685 B
C++
// RUN: %clang_cc1 -std=c++20 -verify %s
|
|
|
|
namespace P1972 {
|
|
template <typename T>
|
|
struct S {
|
|
static void f(int)
|
|
requires false; // expected-note 4{{because 'false' evaluated to false}}
|
|
};
|
|
void g() {
|
|
S<int>::f(0); // expected-error{{invalid reference to function 'f': constraints not satisfied}}
|
|
void (*p1)(int) = S<int>::f; // expected-error{{invalid reference to function 'f': constraints not satisfied}}
|
|
void (*p21)(int) = &S<int>::f; // expected-error{{invalid reference to function 'f': constraints not satisfied}}
|
|
decltype(S<int>::f) *p2 = nullptr; // expected-error{{invalid reference to function 'f': constraints not satisfied}}
|
|
}
|
|
}
|