Ian Lance Taylor wrote:
namespace
{
template <typename T>
class A
{
virtual T f1() { return c; }
static const T c = 0;
};
Thanks for the analysis!
All those steps seem reasonable. If the anonymous namespace is
removed from the test case, all is well because DECL_EXTERNAL is set.
When using the anonymous namespace, DECL_EXTERNAL is not set.
That seems wrong. This declaration is not a definition. For example, a
reference to &A<int>::c from within this file should be unresolved at
link-time. (The standard says that this is an invalid thing to do; I
don't know if it says that a diagnostic is required.)