[PATCH] D41217: [Concepts] Concept Specialization Expressions

Saar Raz via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 3 12:40:43 PST 2018


saar.raz added inline comments.


================
Comment at: test/CXX/concepts-ts/expr/expr.prim/expr.prim.id/p3.cpp:12
+
+template<typename T> concept C3 = sizeof(*T{}) == 4;
+static_assert(C3<int*>);
----------------
Quuxplusone wrote:
> "test/Parser/cxx-concept-declaration.cpp" has some syntax tests for "value-concepts" of the form `template<bool x> concept...`. Would it make sense to add some semantic tests for `template<bool x> concept...` in or near this test file?
> (This could plausibly be "out of scope." I merely mention it.)
Good idea, I'll add some of those.


================
Comment at: test/Parser/cxx-concept-declaration.cpp:36
+template<typename T> concept C11 = sizeof(T); // expected-error {{atomic constraint 'sizeof(T)' must be of type 'bool' (found 'unsigned long')}}
+template<typename T> concept C12 = T{};
+template<typename T> concept C13 = (bool&&)true;
----------------
Quuxplusone wrote:
> Peanut gallery says: IIUC, C12<T> is satisfied whenever T has a constexpr constructor and a constexpr implicit conversion to `bool` that returns `true`?  Or (because this is an atomic constraint and atomic constraints don't do conversions, as we can see on line 31 above) is C12<T> *actually* never satisfiable (but there's no diagnostic expected here because `T{}` is dependent)?
C12 will only accept bool, and there's no diagnostic because it's dependent is correct.


Repository:
  rC Clang

https://reviews.llvm.org/D41217





More information about the cfe-commits mailing list