[PATCH] D41284: [Concepts] Associated constraints infrastructure.
Arthur O'Dwyer via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 18 15:58:39 PDT 2018
Quuxplusone added inline comments.
================
Comment at: test/CXX/concepts-ts/temp/temp.constr/temp.constr.decl/var-template-decl.cpp:10
+
+template <typename U> requires bool(U())
+int B::A = int(U());
----------------
saar.raz wrote:
> Quuxplusone wrote:
> > For my own edification, could you explain whether, given
> >
> > #define BOOL bool
> > using typedef_for_bool = bool;
> >
> > you'd expect to diagnose a redeclaration of `B::A` with associated constraint
> >
> > requires bool( U() ) // extra whitespace
> >
> > or
> >
> > requires BOOL(U()) // different spelling of `bool`
> >
> > or
> >
> > requires typedef_for_bool(U()) // different spelling of `bool`
> >
> > ? My naive reading of N4762 temp.constr.atomic/2 says that none of these constraints (on line 10) would be "identical" to the constraint on line 6... but then I don't understand what's the salient difference between line 10 (which apparently gives no error) and line 22 (which apparently gives an error).
> Line 22 has a not (!) operator in front of the bool(), I guess you missed that?
I saw the `!`... but I don't understand how the compiler "knows" that `!bool(U())` is "different" from `bool(T())` in a way that doesn't equally apply to `bool(U())`.
Or suppose the constraint on line 10 was `requires bool(U())==true`... would that give a diagnostic?
Repository:
rC Clang
https://reviews.llvm.org/D41284
More information about the cfe-commits
mailing list