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. 
[EMAIL PROTECTED]

#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

Reply via email to