courbet marked 2 inline comments as done.
courbet added inline comments.

================
Comment at: lib/Sema/SemaTemplate.cpp:3061
+#define TYPE_TRAIT_N(Spelling, Name, Key) RecordName == (#Spelling + 2) ||
+#include "clang/Basic/TokenKinds.def"
+#undef TYPE_TRAIT_1
----------------
Quuxplusone wrote:
> Why do you bother to check a whitelist of "known" type trait names? It seems 
> to me that if you replaced this function body with `return true;`, the 
> diagnostic would automatically be able to handle cases such as
> 
>     static_assert(std::is_trivially_move_constructible<T>::value);  // not a 
> builtin
>     static_assert(folly::IsRelocatable<T>::value);  // not in namespace std
> 
> What would go wrong if you replaced this entire function body with `return 
> true;`?
That's a very good question. I guess because I was mainly interested in this. 
But now that I think of it, there is no reason to limit to  "known" type 
traits, or even to type traits at all. Any qualified DeclRefExpr shoul see its 
qualifiers be spelled out with explicit types, e.g.

`ns::S1<T>::S2<int, typename U::value_type>::var`

should be diagnosed as something like:

`ns::S1<double>::S2<int, long int>::var`

I've done that and added unit tests. Tell me what you think.



Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D54903/new/

https://reviews.llvm.org/D54903



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to