This is an archive of the discontinued LLVM Phabricator instance.

[Concepts] Add diagnostic: non template declaration
ClosedPublic

Authored by nwilson on Jul 24 2015, 11:43 AM.

Diff Detail

Event Timeline

nwilson updated this revision to Diff 30587.Jul 24 2015, 11:43 AM
nwilson retitled this revision from to [Concepts] Add diagnostic: non template declaration.
nwilson updated this object.
nwilson added a subscriber: cfe-commits.
include/clang/Basic/DiagnosticSemaKinds.td
1970

Using just "concept" here to refer to the specifier is a bit confusing. Perhaps:
"the concept specifier may only be applied to the definition of a function or variable template"

nwilson updated this revision to Diff 30598.Jul 24 2015, 1:22 PM

modifying diagnostic message to: 'concept' can only appear on the definition of a function template or variable template

In test/Parser/cxx-concept-declaration.cpp:

concept D1 = true; // expected-error {{C++ requires a type specifier for all declarations}}

triggers the new error and fails the test.

rsmith accepted this revision.Jul 29 2015, 4:40 PM
rsmith edited edge metadata.

LGTM

This revision is now accepted and ready to land.Jul 29 2015, 4:40 PM

Thanks Richard.

Sorry about the failed test that Hubert brought up. I'll remove that if no
one objects since it's covered by the Sema tests in this Patch.

Potentially that test in the Parser could be modified to be:
template<typename T>
concept D1 = true;

However, it will just pass and I believe it needs a diagnostic for the
return type not being bool.

nwilson updated this revision to Diff 30984.Jul 29 2015, 9:21 PM
nwilson edited edge metadata.

Removing failing test case (in Parser) created by this Patch