This is an archive of the discontinued LLVM Phabricator instance.

[Concepts] Add diagnostic; invalid specifier on function or variable concept declaration
ClosedPublic

Authored by nwilson on Aug 28 2015, 9:25 AM.

Diff Detail

Event Timeline

nwilson updated this revision to Diff 33434.Aug 28 2015, 9:25 AM
nwilson retitled this revision from to [Concepts] Add diagnostic; invalid specifier on function or variable concept declaration.
nwilson updated this object.
nwilson added a subscriber: cfe-commits.
include/clang/Basic/DiagnosticSemaKinds.td
1982

The wording seems unwieldy. There are a number of messages of the form:

[ ... ] cannot be declared '<blah>'

Perhaps something along those lines would work here?

btw, there's a typo in the message identifier.

nwilson added inline comments.Aug 28 2015, 2:39 PM
include/clang/Basic/DiagnosticSemaKinds.td
1982

I'll fix the typo. Thanks. I can change the wording as well; I don't feel too strongly about it unless someone has a different opinion. Are you okay with the second select?

So, it would be:
"%select{variable|function}0 concept cannot be declared %select{thread_local|constexpr|inline}1"

include/clang/Basic/DiagnosticSemaKinds.td
1982

Not sure if other people have an opinion, but the single quotes around, e.g., 'inline' would fit. For 'friend', the quoted version is terser (without quotes, it would be awkward). On that note, if we plan to use this message for the "friend" case, let's add it in the same order as the quoted portion of the TS now.

nwilson updated this revision to Diff 33587.Aug 31 2015, 10:12 AM

Change the wording of diagnostic message and quote the invalid specifier. Add 'friend' as an invalid specifier and diagnose function concepts when 'friend' is specified. Reorder the list of invalid specifiers and corresponding checks in the code to match the TS.

This revision is now accepted and ready to land.Sep 4 2015, 5:42 PM
nwilson closed this revision.Sep 9 2015, 2:49 PM