------- Comment #3 from bangerth at dealii dot org  2006-10-10 04:11 -------
Confirmed:
--------------
template <typename T> struct A {};

template <template <typename> class P>
struct B {
    template <template <typename> class Q>
    friend bool foo (const B<Q>& a);
};

template <template <typename> class Q>
bool foo (const B<Q>& a);

void bar () {
  B<A> a;
  foo (a);
}
--------------------------

g/x> /home/bangerth/bin/gcc-4.2-pre/bin/c++ -c x.cc
x.cc: In function &#8216;void bar()&#8217;:
x.cc:14: error: call of overloaded &#8216;foo(B<A>&)&#8217; is ambiguous
x.cc:10: note: candidates are: bool foo(const B<Q>&) [with Q = A]
x.cc:6: note:                 bool foo(const B<Q>&) [with Q = A, P = A]


icc accepts the code. I believe we simply forget to unify the tentative
declaration from the friend declaration with the real template once we
encounter it, and end up with two declarations instead of one. We then
get confused when we have to pick one of the two.

This is a regression introduced in 3.2 over 2.95.

W.


-- 

bangerth at dealii dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bangerth at dealii dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |rejects-valid
      Known to fail|                            |3.2.3 3.3.5 3.4.6 4.0.1
                   |                            |4.1.1 4.2.0
      Known to work|                            |2.95
           Priority|P3                          |P2
   Last reconfirmed|0000-00-00 00:00:00         |2006-10-10 04:11:45
               date|                            |
            Summary|Friend operators for class  |[4.0/4.1/4.2? regression]
                   |with template in template   |Bogus ambiguity with
                   |argument does not compile   |templates + friend
   Target Milestone|---                         |4.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29236

Reply via email to