aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Redl <sebastian.redl@getdesigned.at>2009-05-14 18:11:41 +0000
committerSebastian Redl <sebastian.redl@getdesigned.at>2009-05-14 18:11:41 +0000
commit9afe1308ed19dffc281dca5cfbe521826754980f (patch)
tree80b53c11ddcaa72d450187bfd8f707fd8cacf67b
parent236673e8fbd391cc7827efcaa64320344900d348 (diff)
When there are any member new operators, global versions aren't looked up at all.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@71780 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExprCXX.cpp2
-rw-r--r--test/SemaCXX/new-delete.cpp6
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 57aae29631..e2a21d9b3f 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -533,8 +533,6 @@ bool Sema::FindAllocationOverload(SourceLocation StartLoc, SourceRange Range,
}
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);
diff --git a/test/SemaCXX/new-delete.cpp b/test/SemaCXX/new-delete.cpp
index 6fbf2c1386..2f763e0f78 100644
--- a/test/SemaCXX/new-delete.cpp
+++ b/test/SemaCXX/new-delete.cpp
@@ -12,7 +12,7 @@ struct T; // expected-note{{forward declaration of 'struct T'}}
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 @@ void good_news()
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 bad_news(int *ip)
(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.