------- Comment #6 from reichelt at gcc dot gnu dot org  2007-07-11 23:04 
-------
Mark, I don't think the fix for this PR is complete, because the following
simplified testcase (which previously ICE'd) should compile IMHO:

=============================================================
template<typename> struct A
{
  A& operator<<(void (*)(A&));
};

template<typename T> A<T>& operator<<(A<T>&, const A<T>&);

template<typename T> void foo(A<T>&);

void bar()
{
  A<int>() << (1, foo<int>);
}
=============================================================

But it is rejected with the following error message:

bug.cc: In function 'void bar()':
bug.cc:12: error: no match for 'operator<<' in 'A<int>() << (0, foo<int>)'
bug.cc:3: note: candidates are: A< <template-parameter-1-1> >& A<
<template-parameter-1-1> >::operator<<(void (*)(A< <template-parameter-1-1>
>&)) [with <template-parameter-1-1> = int]

An even smaller testcase for this problem is the following:

=============================================================
struct A
{
  A& operator<<(void (*)(A&));
};

template<typename> void foo(A&);

void bar()
{
  A() << (1, foo<int>);
}
=============================================================

bug.cc: In function 'void bar()':
bug.cc:10: error: no match for 'operator<<' in 'A() << (0, foo<int>)'
bug.cc:3: note: candidates are: A& A::operator<<(void (*)(A&))

The code compiles fine, if I remove the "0,".

Btw, there's another glitch in the error message:
The code contains "(1, foo<int>)", which is printed as "(0, foo<int>)"
in the error message.


-- 

reichelt at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mark at codesourcery dot com


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

Reply via email to