[Bug c++/63739] New: template id needed for constructor inheritance with using keyword
darkdragon-001 at web dot de
gcc-bugzilla@gcc.gnu.org
Tue Nov 4 17:29:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63739
Bug ID: 63739
Summary: template id needed for constructor inheritance with
using keyword
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: darkdragon-001 at web dot de
There are problems with automatically determining the template id when
inheriting constructors with using keyboard.
In the following example there is only one case (out of four) which works as
expected (-> see NOTE comments)
#include <iostream>
#include <utility>
class A : public std::pair<int,bool> {
// NOTE here it is not possible to ommit the template id
// EXPECTED "using std::pair::pair;"
using std::pair<int,bool>::pair;
};
template<class T>
class B : public std::pair<T,bool> {
// NOTE here it is not possible to ommit the template id
// EXPECTED "using std::pair::pair;"
using std::pair<T,bool>::pair;
};
// NOTE following examples use namespace std
using namespace std;
class C : public pair<int,bool> {
using pair::pair;
};
template<class T>
class D : public pair<T,bool> {
// NOTE here it is not possible to ommit the template id
// EXPECTED "using pair::pair;"
using pair<T,bool>::pair;
};
int main() {
A a(5,true);
cout << "a.first:" << a.first << endl;
B<int> b(5,true);
cout << "b.first:" << b.first << endl;
C c(5,true);
cout << "c.first:" << c.first << endl;
D<int> d(5,true);
cout << "d.first:" << d.first << endl;
return 0;
}
More information about the Gcc-bugs
mailing list