This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Postincrement causes match problem - bug or feature?


The postincrement makes a difference because the result of the postincrement is a temporary value.

You can't pass a temporary value by non const reference.

IIUC, your results would be different if the first definition had const in it as follows:

template <typename T>
int foo(T const& t1)
{
 cerr << "Got in #1!\n";
 return 0;
}



Andrew Bell wrote:
On Mon, Sep 29, 2008 at 10:51 AM, John Love-Jensen <eljay@adobe.com> wrote:
Hi Andrew,

The compiler cannot decide which of the two foo functions are more suitable,
since they are both equally suitable.

The real question is why the postincrement makes a difference. Can you explain?




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]