https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67965
Bug ID: 67965
Summary: gcc (incorrectly) requires template keyword in
non-dependent expression
Product: gcc
Version: 5.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: vanyacpp at gmail dot com
Target Milestone: ---
I believe that in the following example "template" keyword is not required as
expression "f()" is not type dependent. It's a call to a function in current
instantiation and this can not be altered by any specialization.
class B
{
public:
template<typename T>
T f() {
return T{};
}
};
template<typename T>
class C
{
public:
B f()
{
return{};
}
C()
{
f().template f<int>(); // here (!)
}
};
int main()
{
C<int> p;
}