On Thu, May 15, 2025 at 4:07 PM Jonathan Wakely <jwak...@redhat.com> wrote:
> On Thu, 15 May 2025 at 13:56, Tomasz Kaminski <tkami...@redhat.com> wrote: > > > > > > > > On Thu, May 15, 2025 at 2:53 PM Jonathan Wakely <jwak...@redhat.com> > wrote: > >> > >> On Thu, 15 May 2025 at 13:43, Tomasz Kaminski <tkami...@redhat.com> > wrote: > >> > > >> > > >> > > >> > On Thu, May 15, 2025 at 2:41 PM Jonathan Wakely <jwak...@redhat.com> > wrote: > >> >> > >> >> On 15/05/25 14:35 +0200, Tomasz Kaminski wrote: > >> >> >Please also add the message to dg-error check in format_kind_neg.cc. > >> >> >With that LGTM. > >> >> > >> >> Yes, already done locally. Here's what I'm testing now. > >> > > >> > Any reason to not put the whole message "cannot use primary template > of 'std::format_kind'"? > >> > >> It doesn't fit in 80 columns, and doesn't seem to make the test any > >> more or less likely to PASS. > >> > >> e.g. if we change the static_assert message to not use single quotes, > >> or to say 'std::format_kind<R>' or some other change, would we want > >> the test to fail and require changes? Would that improve the value of > >> the test? IMHO it doesn't, because if it matches some substring of the > >> static_assert then the test is working correctly, but I'll change it > >> if you feel strongly. > >> > > Not strongly, but "cannot use primary template" sounds like something > that may be part of > > unrelated compiler error. > > OK, I'll use this and push it: > > +// { dg-error "cannot use primary template of 'std::format_kind'" "" > { target *-*-* } 0 } > Thank you. > > > And we do not check that this is produced from static_assert either. > > I'm not worried about that. I don't think we need to be too paranoid > here, we control the code and diagnostics from GCC aren't going to > just randomly change without us realising. And it doesn't really > matter whether a "cannot use primary template" diagnostic for > std::format_kind comes from a static assert, or a function using > =delete("reason"), or a custom compiler diagnostic, or something else. > All that matters is that it's ill-formed and the message is fairly > user-friendly. > To clarify, I do not mean that we need to check if it is produced by static assert, just having a check "cannot use primary template" + it is from static assert, would also prevent my concern of accidentally matching compiler error messages. But checking for longer substring, including format_kind, is IMHO a better way to do that.