This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/11814] Code with missing "template" keyword wrongly accepted
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 11 Jan 2017 20:02:28 +0000
- Subject: [Bug c++/11814] Code with missing "template" keyword wrongly accepted
- Auto-submitted: auto-generated
- References: <bug-11814-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=11814
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |msebor at gcc dot gnu.org
Known to work| |7.0
Resolution|--- |FIXED
Known to fail| |3.3, 4.5.3, 4.8.3, 4.9.3,
| |5.3.0, 6.3.0
--- Comment #16 from Martin Sebor <msebor at gcc dot gnu.org> ---
With the current trunk of GCC 7.0 the test cases are rejected as expected (GCC
6 still accepts it). Closing as fixed.
$ cat t.C && gcc -O2 -S -Wall -Wextra t.C
template <typename> struct A
{
template <typename> void foo();
};
template <typename T> struct B
{
template <int> void foo()
{
A<T>* p;
p->foo<int>(); // wrong: should be "p->template foo<int>();"
}
};
t.C: In member function ‘void B<T>::foo()’:
t.C:11:16: error: expected primary-expression before ‘int’
p->foo<int>(); // wrong: should be "p->template foo<int>();"
^~~
t.C:11:16: error: expected ‘;’ before ‘int’