Open llvmbot opened 13 years ago
Given:
// { dg-do run }
template<class T> class D {
public:
int f();
};
template<class T> int D<T>::f() {
return sizeof(T);
}
template<template<class> class DD,class EE> class C : DD<EE> {
public:
int f();
};
template<template<class> class DD,class EE> int C<DD,EE>::f() {
return DD<EE>::f();
}
class E : C<D,int> {
public:
int f() { return C<D,int>::f(); }
};
int main() {
E c;
c.f();
}
clang/gcc/MSVC agree this is ill-formed although it looks like EDG does not: https://godbolt.org/z/dehsGMW7v
Extended Description
compiles fine with g++ and intel edg based compiler
/home/rkotler/gcc-4.4.6/gcc/testsuite/g++.old-deja/g++.pt/ttp22.C:27:22: error: 'D' is a private member of 'D'
int f() { return C<D,int>::f(); }
^
/home/rkotler/gcc-4.4.6/gcc/testsuite/g++.old-deja/g++.pt/ttp22.C:13:55: note:
constrained by implicitly private inheritance here
template<template class DD,class EE> class C : DD
^ class D
^
/home/rkotler/gcc-4.4.6/gcc/testsuite/g++.old-deja/g++.pt/ttp22.C:27:22: error:
template argument for template template parameter must be a class
template
int f() { return C<D,int>::f(); }
^
2 errors generated.
~/home/rkotler/gcc-4.4.6/gcc/testsuite/g++.old-deja/g++.pt/ttp22.C:2:25: note: member is declared here templaterkotler@ubuntu-rkotler:~/icpc$ icpc /home/rkotler/gcc-4.4.6/gcc/testsuite/g++.old-deja/g++.pt/ttp22.C rkotler@ubuntu-rkotler:~/icpc$ g++ /home/rkotler/gcc-4.4.6/gcc/testsuite/g++.old-deja/g++.pt/ttp22.C