From 222e2a7620e6520ffaf4fc4e69d79c18da31542e Mon Sep 17 00:00:00 2001 From: "Zancanaro; Carlo" Date: Mon, 24 Sep 2012 09:58:17 +1000 Subject: Add the clang library to the repo (with some of my changes, too). --- .../over.best.ics/over.ics.list/p6.cpp | 15 ++++++ .../over.best.ics/over.ics.user/p3-0x.cpp | 14 +++++ .../over.match.best/over.ics.rank/p3-0x.cpp | 59 ++++++++++++++++++++++ .../CXX/over/over.match/over.match.best/p1.cpp | 16 ++++++ 4 files changed, 104 insertions(+) create mode 100644 clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp create mode 100644 clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp create mode 100644 clang/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp create mode 100644 clang/test/CXX/over/over.match/over.match.best/p1.cpp (limited to 'clang/test/CXX/over/over.match/over.match.best') diff --git a/clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp b/clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp new file mode 100644 index 0000000..ea059ce --- /dev/null +++ b/clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.list/p6.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s + +// rdar://problem/11120365 +namespace test0 { + template struct A { + static void foo(const T &t) {} + static void foo(T &&t) { + t.foo(); // expected-error {{member reference base type 'int' is not a structure or union}} + } + }; + + void test() { + A::foo({}); // expected-note {{requested here}} + } +} diff --git a/clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp b/clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp new file mode 100644 index 0000000..1c71468 --- /dev/null +++ b/clang/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s + +namespace PR6285 { + template struct identity + { typedef T type; }; + + struct D { + template + operator typename identity::type(); // expected-note{{candidate}} + }; + + int f() { return D(); } // expected-error{{no viable conversion}} +} + diff --git a/clang/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp b/clang/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp new file mode 100644 index 0000000..3971acc --- /dev/null +++ b/clang/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp @@ -0,0 +1,59 @@ +// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s +namespace std_example { + int i; + int f1(); + int&& f2(); + int &g(const int &); + float &g(const int &&); + int &j = g(i); + float &k = g(f1()); + float &l = g(f2()); + + int &g2(const int &); + float &g2(int &&); + int &j2 = g2(i); + float &k2 = g2(f1()); + float &l2 = g2(f2()); + + // FIXME: We don't support ref-qualifiers yet. +#if 0 + struct A { + A& operator<<(int); + void p() &; + void p() &&; + }; + + A& operator<<(A&&, char); + A() << 1; + A() << 'c'; + A a; + a << 1; + a << 'c'; + A().p(); + a.p(); +#endif +} + +template +struct remove_reference { + typedef T type; +}; + +template +struct remove_reference { + typedef T type; +}; + +template +struct remove_reference { + typedef T type; +}; + +namespace FunctionReferencesOverloading { + template int &f(typename remove_reference::type&); + template float &f(typename remove_reference::type&&); + + void test_f(int (&func_ref)(int)) { + int &ir = f(func_ref); + } +} diff --git a/clang/test/CXX/over/over.match/over.match.best/p1.cpp b/clang/test/CXX/over/over.match/over.match.best/p1.cpp new file mode 100644 index 0000000..5c315a7 --- /dev/null +++ b/clang/test/CXX/over/over.match/over.match.best/p1.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +template int &f0(T*, int); +float &f0(void*, int); + +void test_f0(int* ip, void *vp) { + // One argument is better... + int &ir = f0(ip, 0); + + // Prefer non-templates to templates + float &fr = f0(vp, 0); +} + +// Partial ordering of function template specializations will be tested +// elsewhere +// FIXME: Initialization by user-defined conversion is tested elsewhere -- cgit v1.2.3