brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.3 KiB · a339e68 Raw
21 lines · cpp
1// RUN: %clang_cc1 -std=c++20 -fsyntax-only -verify %s2 3template <bool... vals>4void 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 error12  // due to the 'diagnose_if'.13  ([] () __attribute((diagnose_if(vals, "foobar", "error"))) {}(), ...); // expected-error {{foobar}} expected-note {{from 'diagnose_if'}}14}15 16void g() {17  f<>();18  f<false>();19  f<true, true>(); // expected-note {{in instantiation of}}20}21