[cfe-commits] r71780 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/SemaCXX/new-delete.cpp
Sebastian Redl
sebastian.redl at getdesigned.at
Thu May 14 11:11:43 PDT 2009
Author: cornedbee
Date: Thu May 14 13:11:41 2009
New Revision: 71780
URL: http://llvm.org/viewvc/llvm-project?rev=71780&view=rev
Log:
When there are any member new operators, global versions aren't looked up at all.
Modified:
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/test/SemaCXX/new-delete.cpp
Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=71780&r1=71779&r2=71780&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Thu May 14 13:11:41 2009
@@ -533,8 +533,6 @@
}
case OR_No_Viable_Function:
- if (AllowMissing)
- return false;
Diag(StartLoc, diag::err_ovl_no_viable_function_in_call)
<< Name << Range;
PrintOverloadCandidates(Candidates, /*OnlyViable=*/false);
Modified: cfe/trunk/test/SemaCXX/new-delete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/new-delete.cpp?rev=71780&r1=71779&r2=71780&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/new-delete.cpp (original)
+++ cfe/trunk/test/SemaCXX/new-delete.cpp Thu May 14 13:11:41 2009
@@ -12,7 +12,7 @@
struct U
{
// A special new, to verify that the global version isn't used.
- void* operator new(size_t, S*);
+ void* operator new(size_t, S*); // expected-note {{candidate}}
};
struct V : U
{
@@ -37,7 +37,7 @@
ia4 *pai = new (int[3][4]);
pi = ::new int;
U *pu = new (ps) U;
- // This is xfail. Inherited functions are not looked up currently.
+ // FIXME: Inherited functions are not looked up currently.
//V *pv = new (ps) V;
}
@@ -68,6 +68,8 @@
(void)new (0L) int; // expected-error {{call to 'operator new' is ambiguous}}
// This must fail, because the member version shouldn't be found.
(void)::new ((S*)0) U; // expected-error {{no matching function for call to 'operator new'}}
+ // This must fail, because any member version hides all global versions.
+ (void)new U; // expected-error {{no matching function for call to 'operator new'}}
(void)new (int[]); // expected-error {{array size must be specified in new expressions}}
(void)new int&; // expected-error {{cannot allocate reference type 'int &' with new}}
// Some lacking cases due to lack of sema support.
More information about the cfe-commits
mailing list