[Bug c++/87651] New: inner class with template template friend declaration of same name fails to compile in gcc 8.1, 8.2, and 9.0
haining.cpp at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Oct 19 04:39:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87651
Bug ID: 87651
Summary: inner class with template template friend declaration
of same name fails to compile in gcc 8.1, 8.2, and 9.0
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: haining.cpp at gmail dot com
Target Milestone: ---
Requirements to repro
1) Outer class must be template
2) Inner class must have template template parameter
#### Sample program ####
template <typename> class Cls;
template <typename>
struct Outer {
template <template <typename> class>
class Failure {
template <template <typename> class>
friend class Failure; // All Failures should be friends
};
using F = Failure<Cls>;
};
int main() {
Outer<void>::F var;
}
#### Error message #####
prog.cc: In instantiation of 'class Outer<void>::Failure<Cls>':
prog.cc:15:18: required from here
prog.cc:5:33: error: template parameter 'template<class> template<class>
class<template-parameter-2-1>'
template <template <typename> class>
^~~~~
prog.cc:8:18: error: redeclared here as 'template<class>
class<template-parameter-1-1>'
friend class Failure;
^~~~~~~
#### Additional Info ####
wandbox links to errors:
- [gcc-8.1.0](https://wandbox.org/permlink/vpzvcXcPUwVm4ent)
- [gcc-8.2.0](https://wandbox.org/permlink/YaD9sml3aPaJExcm)
- [gcc HEAD 9.0.0 20181017 ](https://wandbox.org/permlink/FXqrijJRqbyNT0ZT)
passing with [gcc-7.3.0](https://wandbox.org/permlink/0HQ9K8PuSJBqRmD1)
This is causing several components of
http://github.com/ryanhaining/cppitertools to fail to compile, and I have no
ideas for a workaround besides making my data members public
More information about the Gcc-bugs
mailing list