[PATCH] D40218: [Clang] Add __builtin_launder

Jonathan Roelofs via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 19 13:59:18 PST 2017


jroelofs added inline comments.


================
Comment at: include/clang/Basic/Builtins.def:480
 BUILTIN(__builtin_thread_pointer, "v*", "nc")
+BUILTIN(__builtin_launder, "v*v*", "nt")
 
----------------
GCC's is type-generic:

```
#include <type_traits>

bool is_type_generic() {
  int v;
  return std::is_same<decltype(__builtin_launder(&v)),
                      decltype(&v)>::value;
}
```

However this `BUILTIN` line says that this one is not (yeah, I see it's being fixed up in Sema later in this patch). I think you need to use custom type checking here via `t`.


https://reviews.llvm.org/D40218





More information about the cfe-commits mailing list