https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86747

François-R Boyer <Francois-R.Boyer at PolyMtl dot ca> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Francois-R.Boyer at PolyMtl 
dot ca

--- Comment #3 from François-R Boyer <Francois-R.Boyer at PolyMtl dot ca> ---
I'm not sure if this bug is related or if I should post it as a separate bug
report.  I have the same error messages, with a friend class, but in my case it
is not redundant, and happens in a much more complicated case.  Here is the
code:

template <class> struct A {
    template <template <class> class> struct B {
        template <template <class> class> friend struct B;
    };
};

template <class> struct C { };

A<int>::B<C> b;


The above compiles on latest MSVC, clang, and most other compilers on godbolt,
including g++ 7.3. The error with g++ 8.1, 8.2 and 9.0.0 20181007 on godbolt
is:

<source>: In instantiation of 'struct A<int>::B<C>':
<source>:9:14:   required from here
<source>:2:32: error: template parameter 'template<class> template<class>
class<template-parameter-2-1>'
2 |     template <template <class> class> struct B {
  |                                ^~~~~
<source>:3:57: error: redeclared here as 'template<class>
class<template-parameter-1-1>'
3 |         template <template <class> class> friend struct B;
  |                                                         ^

Note that if struct A is not a template, of if struct B has a simple type
parameter instead of a template template, it compiles.

Reply via email to