Try using this linker option (in Project Properties) — Link Time Code Generation: “Use Link Time Code Generation (/LTCG)”.
How did you check the inlining results?
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
When the following code is compiled with the latest MSVC compiler, the call to the function foo is not inlined. Is there a valid reason for this, or is it a compiler deficiency?
template <auto V>
struct Wrapper
{
static constexpr decltype(V) VALUE = V;
};
void foo(int i) { std::cout << i; }
template <typename T>
void bar(T) { T::VALUE(8); }
int main()
{
bar(Wrapper<&foo>());
}
Try using this linker option (in Project Properties) — Link Time Code Generation: “Use Link Time Code Generation (/LTCG)”.
How did you check the inlining results?