[PATCH] D56035: Provide storage for `true_type::value` and `false_type::value`.
Dan Liew via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 9 01:09:48 PST 2019
delcypher added inline comments.
================
Comment at: lib/sanitizer_common/sanitizer_type_traits.cc:17
+namespace __sanitizer {
+const bool true_type::value;
+const bool false_type::value;
----------------
vitalybuka wrote:
> I guess we can avoid cc file if you use constexpr in the header file.
@vitalybuka I tried that. Unfortunately I still get link errors.
See https://stackoverflow.com/questions/8452952/c-linker-error-with-class-static-constexpr .
An alternative to this patch to just change the test that causes the problem to something like
```
ASSERT_TRUE(bool(is_same<uptr, uptr>::value));
````
This avoids taking a reference to `is_same<T,U>::value` and instead constructs a temporary value from it. The `ASSERT_TRUE` macro then takes a reference to it.
I'm not sure which is better. Changing the test just hides the issue (it will occur again if anyone tries to take a reference to `is_same<T,U>::value`). However this patch bloats the code for the purpose of a single test, which isn't great either.
Let me know, which you'd prefer.
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D56035/new/
https://reviews.llvm.org/D56035
More information about the llvm-commits
mailing list