https://bugs.llvm.org/show_bug.cgi?id=45351
Reid Kleckner <r...@google.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |r...@google.com
Resolution|--- |INVALID
--- Comment #1 from Reid Kleckner <r...@google.com> ---
Clang is allowed to do this inlining. I can't site the standard, but this came
up for me personally while adding extern template decls to LLVM.
Function templates that are declared extern can be inlined if they are marked
inline. Defining a method inside a class body implicitly makes it inline. So,
to avoid the inlining without resorting to fno-inline, write the code like
this:
template <typename T>
struct S {
int func();
};
template <typename T>
int S<T>::func() {
static int function_local_static = 0;
return ++function_local_static;
}
extern template class S<int>;
int user()
{
return S<int>().func();
}
This will prohibit instantiation of S::func and even allow you to specialize it
out of line.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs