| 1 |
// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s |
| 2 |
|
| 3 |
template <bool... vals> |
| 4 |
void f() __attribute((diagnose_if(vals, "message", "error"))) { // expected-error {{expression contains unexpanded parameter pack 'vals'}} |
| 5 |
[] () __attribute((diagnose_if(vals, "message", "error"))) {}(); // expected-error {{expression contains unexpanded parameter pack 'vals'}} |
| 6 |
[] () __attribute((diagnose_if(vals..., "message", "error"))) {}(); // expected-error {{attribute 'diagnose_if' does not support argument pack expansion}} |
| 7 |
[] <bool ...inner> () __attribute((diagnose_if(inner, "message", "error"))) {}(); // expected-error {{expression contains unexpanded parameter pack 'inner'}} |
| 8 |
([] <bool ...inner> () __attribute((diagnose_if(inner, "message", "error"))) {}(), ...); // expected-error {{expression contains unexpanded parameter pack 'inner'}} \ |
| 9 |
// expected-error {{pack expansion does not contain any unexpanded parameter packs}} |
| 10 |
|
| 11 |
// This is fine, so check that we're actually emitting an error |
| 12 |
// due to the 'diagnose_if'. |
| 13 |
([] () __attribute((diagnose_if(vals, "foobar", "error"))) {}(), ...); // expected-error {{foobar}} expected-note {{from 'diagnose_if'}} |
| 14 |
} |
| 15 |
|
| 16 |
void g() { |
| 17 |
f<>(); |
| 18 |
f<false>(); |
| 19 |
f<true, true>(); // expected-note {{in instantiation of}} |
| 20 |
} |