https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86665
Bug ID: 86665
Summary: declaration conflicts with target of using declaration
already in scope
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: zhonghao at pku dot org.cn
Target Milestone: ---
The code is as follow:
namespace Name {
template <class T> class Point;
}
using Name::Point;
template <class T> class Point {
public:
Point() {}
protected:
T member;
};
int main(void) {
Name::Point<double> d;
return(0);
}
g++ accepts it, but clang++ rejects it:
code2.cpp:7:20: error: declaration conflicts with target of using declaration
already in scope
template <class T> class Point {
^
code2.cpp:2:27: note: target of using declaration
template <class T> class Point;
^
code2.cpp:5:13: note: using declaration
using Name::Point;
^
code2.cpp:15:22: error: implicit instantiation of undefined template
'Name::Point<double>'
Name::Point<double> d;
^
code2.cpp:2:27: note: template is declared here
template <class T> class Point;
^
2 errors generated.
My g++ is gcc version 9.0.0 20180715 (experimental) (GCC), and my clang++ is
clang version 7.0.0 (trunk 337118)