llvm-project/clang/test/SemaCXX
Douglas Gregor 66950a32d9 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.

llvm-svn: 83175
2009-09-30 21:46:01 +00:00
..
__null.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
abstract.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
access-base-class.cpp Disable access control by default. It can be enabled with the -faccess-control option. When we have better support for it, we can enable it by default again. 2009-05-13 19:49:53 +00:00
access-control-check.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
access.cpp Set the access specifier for templates inside classes. 2009-03-26 01:24:28 +00:00
addr-of-overloaded-function.cpp Slightly improve the test for partial ordering of overloaded function 2009-09-14 22:31:20 +00:00
address-of.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
aggregate-initialization.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
ambig-user-defined-conversions.cpp Multiple conversions to the same type are ambiguous but for the 2009-09-28 19:06:58 +00:00
anonymous-union.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
arrow-operator.cpp Look for overloaded arrow operators in base classes. 2009-09-10 23:18:36 +00:00
attr-after-definition.cpp Make sure we actually found a redeclaration before complaining about attributes added to a redeclaration in C++ 2009-08-28 22:54:55 +00:00
attr-deprecated.cpp CXXMethodDecl::isVirtual needs to check the canonical declaration. Fixes PR4878. 2009-09-13 21:01:57 +00:00
attr-format.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
attr-unavailable.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
auto-cxx0x.cpp Fix a test. 2009-07-11 01:00:52 +00:00
auto-cxx98.cpp Implement enough of the 'auto' keyword so we can claim to support N2546. 2009-06-26 18:41:36 +00:00
blocks.cpp A block that returns a reference is an lvalue. 2009-05-26 02:03:20 +00:00
bool.cpp Create a new PrintingPolicy class, which we pass down through the AST 2009-05-29 20:38:28 +00:00
c99.cpp Diagnose VLAs as an error in C++. 2009-09-11 00:18:58 +00:00
cast-explicit-ctor.cpp Fix this for real. 2009-08-28 16:57:08 +00:00
class-base-member-init.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
class-layout.cpp Temporary band-aid for handling empty classes somewhat better. 2009-09-17 04:42:56 +00:00
class-names.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
class.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
complex-overload.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
composite-pointer-type.cpp Implement support for equality comparisons (!=, ==) of member 2009-08-24 17:42:35 +00:00
condition.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
conditional-expr.cpp Diagnose taking the address of a bit-field inside a conditional operator. 2009-09-14 23:15:26 +00:00
const-cast.cpp Use "()" instead of "(void)" when pretty-printing a parameter-less function type for C++. 2009-06-03 02:06:50 +00:00
constant-expression.cpp Add a big test case for I-C-Es in C++, and a fix to make it work. The fix might not be the right way to do it. 2009-05-27 19:34:06 +00:00
constructor-initializer.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
constructor-recovery.cpp This is a pretty big cleanup for how invalid decl/type are handle. 2009-04-25 08:06:05 +00:00
constructor.cpp Top-level semicolons are allowed in C++0x. Fixes PR4755. 2009-08-24 12:17:54 +00:00
conversion-delete-expr.cpp 1) don't do overload resolution in selecting conversion 2009-09-15 22:15:23 +00:00
conversion-function.cpp Issue a good diagnostics when attempt to select 2009-09-15 00:10:11 +00:00
convert-to-bool.cpp Create a new PrintingPolicy class, which we pass down through the AST 2009-05-29 20:38:28 +00:00
converting-constructor.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
copy-assignment.cpp When overload resolution fails for an overloaded operator, show the 2009-09-30 21:46:01 +00:00
copy-constructor-error.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
copy-initialization.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
cstyle-cast.cpp Implement C++ semantics for C-style and functional-style casts. This regresses Clang extension conversions, like vectors, but allows conversions via constructors and conversion operators. 2009-07-25 15:41:38 +00:00
dcl_ambig_res.cpp Implement C++ semantics for C-style and functional-style casts. This regresses Clang extension conversions, like vectors, but allows conversions via constructors and conversion operators. 2009-07-25 15:41:38 +00:00
dcl_init_aggr.cpp Improve handling of initialization by constructor, by ensuring that 2009-09-09 23:08:42 +00:00
decl-expr-ambiguity.cpp Ok, ok, I give in. Fix tests for unused result warning. 2009-08-01 06:07:15 +00:00
decl-init-ref.cpp Issue good diagnostics when initializing a refernce type with 2009-09-30 21:23:30 +00:00
decltype-crash.cpp Make having no RUN line a failure. 2009-07-25 12:47:38 +00:00
decltype-overloaded-functions.cpp Improvements to decltype. We now don't crash anymore when the expr is an overloaded function decl. 2009-06-29 22:58:55 +00:00
decltype-pr4444.cpp Decltype needs to have a dependent type if the expr passed to it is type dependent. Fixes PR4444. 2009-06-25 15:00:34 +00:00
decltype-pr4448.cpp Fix PR4448. 2009-06-26 03:02:18 +00:00
decltype-this.cpp Fix type of 'this' and add a decltype test. 2009-07-10 21:35:09 +00:00
default-argument-temporaries.cpp Add a BuildCXXTemporaryObjectExpr and use it so default arguments will be instantiated correctly for temporary object expressions. 2009-08-27 05:08:22 +00:00
default-assignment-operator.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
default-constructor-initializers.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
default1.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
default2.cpp Cleanup and test C++ default arguments. Improvements include: 2009-09-11 18:44:32 +00:00
deleted-function.cpp Issue good diagnostics when initialization failes due to 2009-09-15 19:12:21 +00:00
dependent-types.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
derived-to-base-ambig.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
destructor.cpp Diagnose when a destructor uses a unrelated class type as its name. 2009-07-21 15:28:50 +00:00
direct-initializer.cpp 1) don't do overload resolution in selecting conversion 2009-09-15 22:15:23 +00:00
do-while-scope.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
dynamic-cast.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
elaborated-type-specifier.cpp Implement support for comparing pointers with <, >, <=, >=, ==, and != 2009-05-04 06:07:12 +00:00
empty-class-layout.cpp Start at NextOffset when laying out bases as well. 2009-09-26 01:29:10 +00:00
enum.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
exception-spec.cpp Extend the exception spec test even further. Now I need to implement this. 2009-08-27 19:07:16 +00:00
exceptions.cpp Track down return statements in the handlers of a function-try-block of constructors. Meh ... 2009-04-27 21:33:24 +00:00
expressions.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
fntype-decl.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
friend-class-nodecl.cpp Ensure that the tag decls of friend decls aren't added to the friending class's 2009-09-02 00:55:30 +00:00
friend.cpp Friend declarations are only valid inside class definitions. 2009-05-11 22:55:49 +00:00
function-overloaded-redecl.cpp 13.1-p3 Overloadable declarations 2009-09-29 20:28:06 +00:00
function-redecl.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
function-type-qual.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
functional-cast.cpp Make functional-style casts emit correct messages, and fix a crash-on-invalid. 2009-07-29 13:50:23 +00:00
i-c-e-cxx.cpp Eliminate some "default"s in CheckICE. 2009-09-10 23:31:45 +00:00
illegal-member-initialization.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
implicit-int.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
inherit.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
inline.cpp Diagnose uses of function specifiers on declarations which don't declare 2009-04-07 19:37:57 +00:00
invalid-member-expr.cpp Support explicit C++ member operator syntax, from James Porter! 2009-08-31 19:52:13 +00:00
invalid-template-specifier.cpp Fix a couple issues with parsing invalid nested-name-specifiers. 2009-08-29 04:08:08 +00:00
libstdcxx_is_pod_hack.cpp Introduce an egregious hack to fix PR4828. 2009-09-04 05:53:02 +00:00
linkage-spec.cpp Skip transparent contexts when performing C++ name lookup 2009-08-24 18:55:03 +00:00
member-expr-static.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
member-expr.cpp Use "()" instead of "(void)" when pretty-printing a parameter-less function type for C++. 2009-06-03 02:06:50 +00:00
member-location.cpp PR4103: improve source location information for members of the current 2009-04-29 17:56:47 +00:00
member-name-lookup.cpp When performing unqualified name lookup into a DeclContext, also look into 2009-09-10 16:57:35 +00:00
member-operator-expr.cpp Support explicit C++ member operator syntax, from James Porter! 2009-08-31 19:52:13 +00:00
member-pointer-size.cpp Use the Itanium ABI for member pointers. Add a missing 'break' statement and a test case 2009-05-17 02:06:04 +00:00
member-pointer.cpp Implement support for equality comparisons (!=, ==) of member 2009-08-24 17:42:35 +00:00
missing-members.cpp More missing member goodness. 2009-08-30 07:09:50 +00:00
ms-exception-spec.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
namespace-alias.cpp Check in test for namespace aliases+using directives. 2009-03-31 05:47:19 +00:00
namespace.cpp When overload resolution fails for an overloaded operator, show the 2009-09-30 21:46:01 +00:00
nested-name-spec.cpp Rewrite of our handling of name lookup in C++ member access expressions, e.g., 2009-09-02 22:59:36 +00:00
new-delete.cpp Find operators new/delete in base classes. FIXME -= 2; 2009-09-30 00:03:47 +00:00
no-implicit-builtin-decls.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
nullptr.cpp Implement C++0x nullptr. 2009-05-10 18:38:11 +00:00
offsetof.cpp Fix/re-enable test. 2009-05-03 21:22:18 +00:00
overload-call-copycon.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
overload-call.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
overload-decl.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
overload-member-call.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
overload-value-dep-arg.cpp When doing overload resolution, expressions that are value dependent but not type dependent and of integral type should not be treated as null pointer constants. 2009-08-28 15:55:56 +00:00
overloaded-builtin-operators.cpp When overload resolution fails for an overloaded operator, show the 2009-09-30 21:46:01 +00:00
overloaded-operator-decl.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
overloaded-operator.cpp When overload resolution fails for an overloaded operator, show the 2009-09-30 21:46:01 +00:00
primary-base.cpp If we already set a primary base, don't set it to the first nearly empty base class. 2009-09-22 19:16:59 +00:00
pseudo-destructors.cpp If a destructor is referenced or a pseudo-destructor expression is 2009-09-04 18:29:40 +00:00
qual-id-test.cpp Improve template instantiation for member access expressions that 2009-09-03 21:38:09 +00:00
qualification-conversion.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
qualified-id-lookup.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
qualified-names-diag.cpp Give Type::getDesugaredType a "for-display" mode that can apply more 2009-04-01 15:47:24 +00:00
qualified-names-print.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
references.cpp Make C++ temporary-related expressions provide proper source-range information. 2009-09-23 22:51:26 +00:00
reinterpret-cast.cpp Use "()" instead of "(void)" when pretty-printing a parameter-less function type for C++. 2009-06-03 02:06:50 +00:00
reinterpret-fn-obj-pedantic.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
return-stack-addr.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
return.cpp Add warning for falling off the end of a function that should return a 2009-07-22 23:56:57 +00:00
rval-references.cpp Parse deleted member functions. Parsing member declarations goes through a different code path that I forgot previously. 2009-04-12 17:16:29 +00:00
statements.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
static-array-member.cpp Allow a declaration of an array to complete a prior, incomplete 2009-09-09 01:45:28 +00:00
static-assert.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
static-cast-complete-type.cpp Check that the destination type of a static_cast expression is a complete type. 2009-09-07 18:25:47 +00:00
static-cast.cpp Implement C++ semantics for C-style and functional-style casts. This regresses Clang extension conversions, like vectors, but allows conversions via constructors and conversion operators. 2009-07-25 15:41:38 +00:00
static-initializers.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
struct-class-redecl.cpp In C++, warn when something previously declared as a "struct" is later 2009-05-14 16:41:31 +00:00
this.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
trivial-constructor.cpp Add support for the __has_trivial_destructor type trait. 2009-04-17 02:34:54 +00:00
trivial-destructor.cpp Add support for the __has_trivial_destructor type trait. 2009-04-17 02:34:54 +00:00
type-convert-construct.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
type-definition-in-specifier.cpp When we parse a tag specifier, keep track of whether that tag 2009-05-28 23:31:59 +00:00
type-dependent-exprs.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
type-traits-incomplete.cpp Some (most) type trait expressions require that the argument passed in is a complete type. 2009-07-07 19:06:02 +00:00
type-traits.cpp Implement __is_empty. Patch by Sean Hunt. 2009-08-15 21:55:26 +00:00
typedef-redecl.cpp One can use "class" and "struct" interchangeably to refer to a class 2009-05-03 17:18:57 +00:00
typeid.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
types_compatible_p.cpp Ban the use of __builtin_types_compatible_p in C++; g++ doesn't support it, 2009-05-19 22:28:02 +00:00
unreachable-catch-clauses.cpp Check for identical types in C++ catch expression. Patch by Erik Verbruggen. 2009-07-29 17:15:45 +00:00
unused.cpp PR4103: Silence bogus unused expression warning. 2009-04-29 16:35:53 +00:00
user-defined-conversions.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
using-decl-1.cpp Teach Sema::isDeclInScope to handle overload sets constructed from 2009-09-28 00:47:05 +00:00
using-decl-pr4441.cpp Make it possible for using decls to point to operators. Fixes PR4441. 2009-06-27 00:27:47 +00:00
using-decl-pr4450.cpp When creating LookupResults, see through UsingDecls. Fixes PR4450. 2009-06-26 03:37:05 +00:00
using-decl-templates.cpp CreateDeclRefExprs that point to UnresolvedUsingDecls. 2009-08-29 01:06:32 +00:00
using-directive.cpp Parsing and AST support for using declarations, from John Thompson! 2009-06-20 00:51:54 +00:00
value-dependent-exprs.cpp Disable questionable code for handling isNullPointerConstant on value dependent 2009-09-18 08:46:16 +00:00
vararg-non-pod.cpp Handle variadic constructors better. Share code between BuildCXXConstructExpr and BuildCXXTemporaryObjectExpr. 2009-09-08 01:48:42 +00:00
vector-casts.cpp Improve handling of vector casts in C++. 2009-09-16 19:19:43 +00:00
virtual-override.cpp Check that the function being overridden is virtual. 2009-05-14 22:15:41 +00:00
virtuals.cpp Rename clang to clang-cc. 2009-03-24 02:24:46 +00:00
warn-char-subscripts.cpp Add support for -Wchar-subscripts. Fixes PR4801. 2009-09-14 01:58:58 +00:00
warn-for-var-in-else.cpp Prep for new warning. 2009-07-22 00:43:08 +00:00
warn-reorder-ctor-initialization.cpp Remove tabs, and whitespace cleanups. 2009-09-09 15:08:12 +00:00
wchar_t.cpp Fix for PR4502: add calculation of the integer conversion rank for 2009-07-05 23:44:27 +00:00