This is the mail archive of the gcc-bugs@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]

[Bug c++/16056] New: Strange error


class A{};

template<typename T>
A&  Foo(A& i, T t) { return i;}
template<typename T>
A&  operator^(A& i, T t) { return i;}

template<typename T>
int&    Foo(int& i, T t) { return i;}
template<typename T>
int&    operator^(int& i, T t) { return i;}

void Q(){}

int main() {
    int j;
    A a;
    Foo(a, Q);
    a ^ Q;
    Foo(j, Q);
    j ^ Q;

    return 0;
    }


Gives:

~/ootbc/common/test/src$ g++ foo.cc
foo.cc: In function `int main()':
foo.cc:21: error: invalid operands of types `int' and `void ()()' to binary `operator^'


Seems to fail only with "int" and "function pointer"; works with other types. Fails with other operators, but not with named functions.

Ivan

-- 
           Summary: Strange error
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


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


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