This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/37043] New: fails to find operator match when constructing object on the fly
- From: "scott at stg dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 6 Aug 2008 22:10:24 -0000
- Subject: [Bug c++/37043] New: fails to find operator match when constructing object on the fly
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Code below fails with "no match for operator>>", although works in msvc. If
I'm doing something wrong or there is simple workaround please let me know.
scott@stg.net.
#include <stdio.h>
class FooBar
{
public:
FooBar(const char *s)
{
printf("Constructed: %s\n",s);
}
void Accept(const char *s)
{
printf("Passed: %s\n",s);
}
};
FooBar& operator>> (const char *s,FooBar& dest)
{
dest.Accept(s);
return(dest);
}
int main(int argc,char **argv)
{
FooBar test1("one");
"A">>test1;
"B">>FooBar("two");
}
--
Summary: fails to find operator match when constructing object on
the fly
Product: gcc
Version: 4.1.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: scott at stg dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37043