Is use in a default member initializer still an odr-use, even if the default member initializer is not used by any constructor?
For example, is this program ill-formed because g<A>
is odr-used and therefore its definition implicitly instantiated?
template<typename T>
void g() { sizeof(T); }
struct A;
struct B {
B() : i{} {};
int i = (&g<A>, 0);
};
int main() { }
MSVC thinks no. Clang, GCC and ICC think yes. https://godbolt.org/z/zrr9oEdfe