https://bugs.llvm.org/show_bug.cgi?id=33919
Bug ID: 33919
Summary: Error recovery loses type inheritance relationship?
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Frontend
Assignee: unassignedclangb...@nondot.org
Reporter: jm...@google.com
CC: llvm-bugs@lists.llvm.org
Minimized test case:
namespace ns {
typedef int type;
}
struct base {
};
struct derived : public base {
ns:;type foo() { return 0; }
};
int foo(base& b) {
return 0;
}
int main() {
derived x;
foo(x);
}
Clang (r4053586) is smart enough to notice that I probably meant ns::type:
test.cpp:9:3: error: unknown type name 'ns'
ns:;type foo() { return 0; }
^
test.cpp:9:6: error: expected expression
ns:;type foo() { return 0; }
^
test.cpp:9:7: error: unknown type name 'type'; did you mean 'ns::type'?
ns:;type foo() { return 0; }
^~~~
ns::type
test.cpp:2:15: note: 'ns::type' declared here
typedef int type;
^
but seems to have forgotten the relationship between base and derived?
test.cpp:18:3: error: no matching function for call to 'foo'
foo(x);
^~~
test.cpp:12:5: note: candidate function not viable: no known conversion
from 'derived' to 'base &' for 1st argument
int foo(base& b) {
The actual code that this was minimized from triggered a pretty catastrophic
failure, because the type in which this typo happened inherited a type which
had an overload for std::ostream operator <<, resulting in a helpful 111-line
list of every overload of std::ostream operator <<, per use of <<.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs