Page MenuHomePhabricator

[Concepts] Diagnose when return type of a function concept or declaration type of a variable concept is not bool.
ClosedPublic

Authored by nwilson on Jan 13 2016, 4:08 PM.

Details

Summary

Adding checks and diagnostics which fall under Concepts TS[dcl.spec.concept]p5:
function concepts are required to have 'bool' return type.
Adding checks and diagnostics which fall under Concepts TS[dcl.spec.concept]p6:
variable concepts are required to have 'bool' declaration type.

Remove a test in Parser which caused a regression due to the new checks.

Event Timeline

nwilson updated this revision to Diff 44811.Jan 13 2016, 4:08 PM
nwilson retitled this revision from to [Concepts] Diagnose when return type of a function concept or declaration type of a variable concept is not bool..
nwilson updated this object.
nwilson added a subscriber: cfe-commits.

Please let me know if the subject or summary of this Patch is ambiguous.

Please add tests for const bool for both the function and variable cases (should get the error).

test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp
22 ↗(On Diff #45453)

The declared return type here is bool (N4567 subclause 7.1.6.4 [dcl.spec.auto] paragraph 2).

test/Parser/cxx-concept-declaration.cpp
17 ↗(On Diff #44811)

This is valid.

nwilson updated this revision to Diff 45453.Jan 20 2016, 3:10 PM
nwilson edited edge metadata.
  • Take qualifiers into account.
  • Check VarDecl is valid when checking declaration type to account for constexpr being specified. Is there any opinion on a better way to handle this? I *could* check for both diagnostics in the test...
  • Remove erroneous check for auto (containsPlaceholderType) and associated function concept test.
  • Removed the use of Diagnostic Range because we'd need to enumerate over the various qualifiers.
nwilson marked an inline comment as done.Jan 20 2016, 4:03 PM
nwilson added inline comments.
test/CXX/concepts-ts/dcl.dcl/dcl.spec/dcl.spec.concept/p5.cpp
22 ↗(On Diff #45453)

The erroneous test which Hubert was referring to has been removed.

This revision is now accepted and ready to land.Jan 21 2016, 2:39 PM
This revision was automatically updated to reflect the committed changes.
nwilson marked an inline comment as done.