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

Nathan Wilson nwilson20 at gmail.com
Thu Jun 18 13:50:45 PDT 2015


================
Comment at: lib/Sema/DeclSpec.cpp:899
@@ +898,3 @@
+  if (Concept_specified) {
+    DiagID = diag::warn_duplicate_declspec;
+    PrevSpec = "concept";
----------------
rsmith wrote:
> Why just a warning? [dcl.spec]/2 seems to apply to `concept` just like any other //decl-specifier//.
Wouldn't this be similar to constexpr (above)? Do you think it should error out?

================
Comment at: test/Parser/cxx-concepts-value-function.cpp:3-4
@@ +2,4 @@
+
+/******************************************************************************
+* Support parsing of concept values and functions
+ ******************************************************************************/
----------------
rsmith wrote:
> We typically use BCPL `//`-comments in our C++ testcases, with no line-of-`*`s.
Okay. I'll make the fix.

================
Comment at: test/Parser/cxx-concepts-value-function.cpp:11
@@ +10,3 @@
+
+#ifdef DIAG
+
----------------
rsmith wrote:
> hubert.reinterpretcast wrote:
> > nwilson wrote:
> > > hubert.reinterpretcast wrote:
> > > > hubert.reinterpretcast wrote:
> > > > > -DDIAG=0 would still trigger the #ifdef DIAG here (which explains why the test file might pass with expected-no-diagnostics).
> > > > I meant //without// `expected-no-diagnostics` somewhere.
> > > Hmm, yeah, I missed that and thought it was working. Is there a better way to use/suppress the diagnostic cases?
> > `#if DIAG` instead of `#ifdef` would work. I guess `expected-no-diagnostics` could be in the `#else` for that.
> Just run the test once, and remove the `#ifdef`.
I'll submit a patch for this shortly so you guys can see if this explanation doesn't make sense. But, how about if I use the directives likes this:

#if DIAG == 0
// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s -DDIAG=0
// expected-no-diagnostics

*** test cases ***

#elif DIAG == 1
// RUN: %clang_cc1 -std=c++14 -fconcepts-ts -x c++ -verify %s -DDIAG=1

*** test cases ***

#endif



================
Comment at: test/Parser/cxx-concepts-value-function.cpp:15
@@ +14,3 @@
+
+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}}
+
----------------
rsmith wrote:
> Which of the various errors on this line are you trying to test here?
All of those diagnostics are generated, so I guess all of them.

Is there a better way to do it? Should I only handle one?

http://reviews.llvm.org/D10528

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






More information about the cfe-commits mailing list