cconvey commented on code in PR #13267:
URL: https://github.com/apache/tvm/pull/13267#discussion_r1013363645
##########
src/tir/transforms/narrow_datatype.cc:
##########
@@ -187,6 +187,11 @@ class DataTypeVisitor final : public StmtExprVisitor {
arith::ConstIntBoundAnalyzer::BoundMapType bound_;
};
+#if __clang__
Review Comment:
I don't think adding more overloads to the parent class changes the issue.
Here's how I understand it (but I may be missing something...)
Suppose we have code like this:
``` c++
#include <iostream>
using namespace std;
class BaseClass {
public:
virtual void foo(int x) {
cout << "BaseClass::foo(int): x = " << x << endl;
}
};
class DerivedClass : public BaseClass {
public:
virtual void foo(float x) {
cout << "DerivedClass::foo(float): x = " << x << endl;
}
};
int main() {
DerivedClass d;
d.foo(42);
}
```
Many people would expect this to print `BaseClass::foo(int): x = 42` because
`42` is an int.
But what _actually_ gets printed is `DerivedClass::foo(float): x = 42`.
This is unintuitive for a lot of C++ programmers, which I think is why this
warning was created.
IIUC, it adding the `using ...` statements that @Lunderberg proposed would
make this code behave more like you intended originally.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]