Static constexpr odr-used or not?
问题 How come that the following works on gcc but doesn\'t on clang , ( see it live ): constexpr int giveMeValue() { return 42; } struct TryMe { static constexpr int arr[1] = { giveMeValue() }; }; int main() { int val = TryMe::arr[0]; return val; } I get an unresolved external symbol with clang. Is TryMe::arr[0] an object? If it is, is it odr-used? 回答1: TryMe::arr is odr-used but you don't provide a definition ( see it live ): constexpr int TryMe::arr[1]; Why is the result inconsistent between gcc