summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/lookup/new1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/lookup/new1.C')
-rw-r--r--gcc/testsuite/g++.dg/lookup/new1.C14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/lookup/new1.C b/gcc/testsuite/g++.dg/lookup/new1.C
new file mode 100644
index 000000000..11a6d97dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lookup/new1.C
@@ -0,0 +1,14 @@
+// { dg-do compile }
+// Origin: <igodard at rational dot com>
+// PR c++/2518: operator new must not be looked up in local scope
+
+int main() {
+ int i;
+ void* operator new(__SIZE_TYPE__ s, int* p);
+ int* e = new(&i) int; // { dg-error "no matching function" }
+ // { dg-message "candidate" "candidate note" { target *-*-* } 8 }
+ int* f = new int;
+ return 0;
+}
+
+// { dg-message "operator new|candidate expects" "" { target *-*-* } 0 }