diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-09-30 21:46:01 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-09-30 21:46:01 +0000 |
commit | 3307475eb0dd6e5d88be9392ea8247d0b6b812df (patch) | |
tree | 682b4d57612577b8e8b6890bbddc3d52ec8f83f7 /test/CodeGenCXX/anonymous-namespaces.cpp | |
parent | 60a90cc99ac24f9117d376c55d3c699296b23963 (diff) |
When overload resolution fails for an overloaded operator, show the
overload candidates (but not the built-in ones). We still rely on the
underlying built-in semantic analysis to produce the initial
diagnostic, then print the candidates following that diagnostic.
One side advantage of this approach is that we can perform more validation
of C++'s operator overloading with built-in candidates vs. the
semantic analysis for those built-in operators: when there are no
viable candidates, we know to expect an error from the built-in
operator handling code. Otherwise, we are not modeling the built-in
semantics properly within operator overloading. This is checked as:
assert(Result.isInvalid() &&
"C++ binary operator overloading is missing
candidates!");
if (Result.isInvalid())
PrintOverloadCandidates(CandidateSet, /*OnlyViable=*/false);
The assert() catches cases where we're wrong in a +Asserts build. The
"if" makes sure that, if this happens in a production clang
(-Asserts), we still build the proper built-in operator and continue
on our merry way. This is effectively what happened before this
change, but we've added the assert() to catch more flies.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83175 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenCXX/anonymous-namespaces.cpp')
0 files changed, 0 insertions, 0 deletions