Commit b9d969b7 by Jason Merrill

new

From-SVN: r34366
parent c9b39473
// Test that 'extern template' suppresses instantiations.
// Special g++ Options: -g -O
// Ignore the 'ld returned 1' message from collect2.
// excess errors test - XFAIL *-*-*
template <class T> void f (T) { }
extern template void f (int);
template <class T> struct A {
void f () { }
};
extern template struct A<int>;
int main ()
{
f (42); // ERROR - not instantiated
A<int> a;
a.f (); // ERROR - not instantiated
f (2.0); // gets bogus error
A<double> b;
b.f (); // gets bogus error
}
// Test that 'static template' instantiates statics.
// Special g++ Options: -g -fno-implicit-templates
// Ignore the 'ld returned 1' message from collect2.
// excess errors test - XFAIL *-*-*
template <class T> struct A {
static T t;
};
template <class T> T A<T>::t = 0;
static template struct A<int>;
int main ()
{
A<int>::t = 42; // gets bogus error
A<char>::t = 42; // ERROR - not instantiated
}
// Test that 'inline template' instantiates the vtable.
// Special g++ Options: -g -O -fno-implicit-templates
// Ignore the 'ld returned 1' message from collect2.
// excess errors test - XFAIL *-*-*
template <class T> struct A {
virtual void f () { }
};
inline template struct A<int>;
A<int> a; // gets bogus error
A<char> b; // ERROR - not instantiated
int main ()
{
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment