This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/80521] Wrong line reported in error for missing template argument in friend class declaration.
- From: "blubban at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 27 Apr 2017 22:47:45 +0000
- Subject: [Bug c++/80521] Wrong line reported in error for missing template argument in friend class declaration.
- Auto-submitted: auto-generated
- References: <bug-80521-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80521
Alfred Agrell <blubban at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |blubban at gmail dot com
--- Comment #1 from Alfred Agrell <blubban at gmail dot com> ---
Ran into this one myself, reproduces on 6.3.0-12ubuntu2 and 8.0.0 20170427
Godbolt. Minimized testcase:
template<typename T>
class foo {
int a;
int b; // error here
void c() {}
/* template<typename> */ friend class bar; // error should be here
};
template<typename T> class bar {
foo<int> baz;
};
template class bar<int>;
Expected output:
<source>: In instantiation of 'class foo<int>':
<source>:13:11: required from here
<source>:9:40: error: template argument required for 'class bar'
/* template<typename> */ friend class bar; // error should be here
^
Actual output:
<source>: In instantiation of 'class foo<int>':
<source>:13:11: required from here
<source>:5:6: error: template argument required for 'class bar'
int b; // error here
^
Clang output:
<source>:12:28: error: redefinition of 'bar' as different kind of symbol
template<typename T> class bar {
^
<source>:9:40: note: previous definition is here
/* template<typename> */ friend class bar; // error should be here
^