2 ms·
> However, `g_s` violates ODR because despite that there’s only one definition of it, there are still multiple declarations which are different because there ar
by steerablesafe 6y ago
> However, `g_s` violates ODR because despite that there’s only one definition of it, there are still multiple declarations which are different because there are two different lambdas in a.cpp and b.cpp, thus, S has different non-type template argument.
Doesn't https://eel.is/c++draft/basic.def.odr#13.10 https://eel.is/c++draft/basic.def.odr#13.10 apply here? This would make it not an ODR violation, although I wonder if compilers implement this in this specific case.
I agree with the message though, lambda expressions in unevaluated contexts open new interesting ways for ODR violations.
- MauranKilom 6y agoIt's definition vs declaration: > In each such definition > However, g_s violates ODR because despite that there’s only one definition of it, there are still multiple declarations