svenevs/exhale

Operator>>, <<, -> overloading bug

Hyrae opened this issue ยท 4 comments

Hyrae commented

When parsing some overloaded operators, exhale misinterprets it for a template and produces an error.

(!) Invalid C++ template: operator<< has 2 '<' and 0 '>', exhale does not know what to do with your code.NoneType: None

Minimal example:

std::ostream& operator<<(std::ostream& os, const MyType& t) {
    os << t.toString();
    return os;
}

This happens with operators <<, >> and ->.

Hyrae commented

There should be a test here if the node contains the operator name:

exhale/exhale/graph.py

Lines 2434 to 2439 in c10eddd

n_lt = node.name.count("<")
n_gt = node.name.count(">")
if n_lt != n_gt:
utils.fancyError(
f"Invalid C++ template: {node.name} has {n_lt} '<' and {n_gt} '>', "
"exhale does not know what to do with your code.")

In my project this also happens with operator<, operator>, operator<=, operator>=

(!) Invalid C++ template: TRAP::Network::operator< has 1 '<' and 0 '>', exhale does not know what to do with your code.NoneType: None

Whoops, thanks for reporting!

Fix inbound when I'm available, should be straightforward. This is a regression from the 0.3.2 release, use 0.3.1 if you need docs building ASAP but I'll have a new release out this weekend fixing it.

Fixed in v0.3.4, you should update your requirements to need exhale>=0.3.4.