[PATCH] D41217: [Concepts] Concept Specialization Expressions

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 16 19:35:19 PDT 2018


hubert.reinterpretcast added inline comments.


================
Comment at: lib/AST/ExprCXX.cpp:1478
+  {
+    // We do not want error diagnostics escaping here.
+    Sema::SFINAETrap Trap(S);
----------------
saar.raz wrote:
> faisalv wrote:
> > Hubert: This needs a TODO: the idea is not to drop SFINAE errors, but to avoid instantiation that may trigger errors not in the immediate context of instantiation. The substitution needs to happen piecewise.
> Could you elaborate/give an example where this handling is inappropriate?
Determining satisfaction requires normalization (lazy normalization should be considered).
The determination of satisfaction then proceeds by handling the left-hand side of conjunction and disjunction constraints before possibly substituting into the right-hand side; i.e., there is short-circuiting behaviour.

Example:
```
template <typename T>
concept C = true;

template <typename T>
struct Q { static constexpr T value = nullptr; };

template <typename T>
requires C<T> || T::value
struct A { };

template <typename T>
requires C<T> || Q<T>::value
struct B { };

A<int> a; // okay
B<int> b; // okay
```



Repository:
  rC Clang

https://reviews.llvm.org/D41217





More information about the cfe-commits mailing list