diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-11-15 15:41:16 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-11-15 15:41:16 +0000 |
commit | 8d706ecf488c4f548c4f8cf0aa08ea82a4d6a5ba (patch) | |
tree | dcee24fb251575a2617acf67f2f2b61dda9544e9 /test/CXX | |
parent | 858a546d8fe73b07f2296313bef2e30445ea164b (diff) |
Implement C++0x [temp.func.order]p3 (aka DR532) properly. In
particular, we only add the implement object parameter type if only
one of the function templates is a non-static member function
template.
Moreover, since this DR differs from existing practice in C++98/03,
this commit implements the existing practice (which ignores the
first parameter of the function template that is not the non-static
member function template) in C++98/03 mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119145 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CXX')
3 files changed, 33 insertions, 16 deletions
diff --git a/test/CXX/over/over.match/over.match.funcs/p4.cpp b/test/CXX/over/over.match/over.match.funcs/p4.cpp deleted file mode 100644 index e06b86351f..0000000000 --- a/test/CXX/over/over.match/over.match.funcs/p4.cpp +++ /dev/null @@ -1,16 +0,0 @@ -// RUN: %clang_cc1 -fsyntax-only -verify %s - -namespace PR8130 { - struct A { }; - - template<class T> struct B { - template<class R> int &operator*(R&); // #1 - }; - - template<class T, class R> float &operator*(T&, R&); // #2 - void test() { - A a; - B<A> b; - int &ir = b * a; // calls #1a - } -} diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp new file mode 100644 index 0000000000..11ec28918e --- /dev/null +++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s + +// Core DR 532. +namespace PR8130 { + struct A { }; + + template<class T> struct B { + template<class R> int &operator*(R&); + }; + + template<class T, class R> float &operator*(T&, R&); + void test() { + A a; + B<A> b; + int &ir = b * a; + } +} diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp new file mode 100644 index 0000000000..2ffdd9579e --- /dev/null +++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3.cpp @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -fsyntax-only -verify %s + +namespace DeduceVsMember { + template<typename T> + struct X { + template<typename U> + int &operator==(const U& other) const; + }; + + template<typename T, typename U> + float &operator==(const T&, const X<U>&); + + void test(X<int> xi, X<float> xf) { + float& ir = (xi == xf); + } +} |