Commit eb56e635 by Jason Merrill

new

From-SVN: r18596
parent cae40af6
......@@ -13,6 +13,8 @@ void f ()
typename A<T>::template B<U> b2;
b.A<T>::template B<U>::~B();
}
template <class T> struct C: public A<T>::B<T> { };
main ()
{
......
// Compiler: egcs-2.91.12 980302
// Error: compiler error in ctor of 'foo::bar<T>::bar(T const &)'
struct foo
{
template <typename T>
struct bar
{
bar(T const &t) : tt(t) {}
T tt;
};
};
int main()
{
foo::bar<int> fb(3);
return 0;
}
struct S
{
template <class U>
struct Y {
template <class T>
void foo(T t);
template <>
void foo<int>(int i) { }
};
};
int main()
{
S::Y<char> s;
s.template foo<int>(3.0);
}
// Build don't link:
template < class T, template <class> class E1, template <class> class E2 >
struct Add {
Add(const E1<T>& e1, const E2<T>& e2) {}
};
template < class T, template <class> class E1, template <class> class E2 >
struct Mul {
Mul(const E1<T>& e1, const E2<T>& e2) {}
};
template < class T >
struct Lit {
Lit(const T& t) {}
};
template < class T >
struct Id {
Add < T, Id, Lit > operator+(const T& t) const {
return Add < T, Id, Lit >(*this, Lit<T>(t));
}
Mul < T, Id, Lit > operator*(const T& t) const {
return Mul < T, Id, Lit >(*this, Lit<T>(t));
}
};
// Build don't link:
template < class T, template < class > class E1, template < class > class E2 >
class Add {
public:
Add(const E1<T>& e1, const E2<T>& e2) {}
};
template < class T >
struct Id {
template < template < class > class E >
Add < T, Id, E > operator+(const E<T>& e) const {
return Add < T, Id, E >(*this, e);
}
};
template struct Id<double>;
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