[PATCH] [PATCH] [CONCEPTS] Parsing of concept keyword

Richard Smith richard at metafoo.co.uk
Thu Jun 18 20:26:58 PDT 2015


================
Comment at: test/Parser/cxx-concepts-value-function.cpp:1
@@ +1,2 @@
+
+// Support parsing of function concepts and variable concepts
----------------
The name of this test file could be better. Something like 'cxx-concept-declaration.cpp', maybe, if you're intending on putting tests for the other parsing changes (requires-clauses, requires-expressions, concept-introducer syntax, ...) into separate files?

================
Comment at: test/Parser/cxx-concepts-value-function.cpp:30
@@ +29,2 @@
+
+template< concept T > concept bool D2 { return true; } // expected-error {{unknown type name 'T'}} expected-error {{expected expression}} expected-error {{expected ';' at end of declaration}}
----------------
nwilson wrote:
> Is there a better way to list multiple diagnostics that would occur from the same declaration? When separating out each declaration for each test case such as:
> 
> template< concept T > concept bool D2 { return true; } // expected-error {{unknown type name 'T'}}
> template< concept T > concept bool D3 { return true; } // expected-error {{expected expression}}
> template< concept T > concept bool D4 { return true; } // expected-error {{expected ';' at end of declaration}}
> 
> clang complains:
> 'error' diagnostics seen but not expected:
> 
> and lists all of the diagnostics.
> 
Try changing your test so each case only fails in one way. Like: 

    template< concept T > concept bool D2 = true; // expected-error {{unknown type name 'T'}}
    template< typename T > concept bool D3 { return true; }; // expected-error {{expected expression}}
    template< typename T > concept bool D4 { true } // expected-error {{expected ';' at end of declaration}}

... though the second and third cases are really testing variable/function disambiguation and don't have anything to do with concepts, so I'm not sure they belong here at all.

http://reviews.llvm.org/D10528

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the cfe-commits mailing list