[cfe-commits] r123979 - in /cfe/trunk: lib/Sema/SemaOverload.cpp test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp
Douglas Gregor
dgregor at apple.com
Fri Jan 21 08:48:38 PST 2011
Author: dgregor
Date: Fri Jan 21 10:48:38 2011
New Revision: 123979
URL: http://llvm.org/viewvc/llvm-project?rev=123979&view=rev
Log:
Add test for overload resolution's preference for binding an rvalue
reference to an rvalue rather than binding a const-qualified lvalue
reference to that rvalue.
Added:
cfe/trunk/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp
Modified:
cfe/trunk/lib/Sema/SemaOverload.cpp
Modified: cfe/trunk/lib/Sema/SemaOverload.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOverload.cpp?rev=123979&r1=123978&r2=123979&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOverload.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOverload.cpp Fri Jan 21 10:48:38 2011
@@ -2434,9 +2434,9 @@
// implicit object parameter of a non-static member function declared
// without a ref-qualifier, and S1 binds an rvalue reference to an
// rvalue and S2 binds an lvalue reference.
- // FIXME: We don't know if we're dealing with the implicit object parameter,
- // or if the member function in this case has a ref qualifier.
- // (Of course, we don't have ref qualifiers yet.)
+ // FIXME: Rvalue references. We don't know if we're dealing with the
+ // implicit object parameter, or if the member function in this case has a
+ // ref qualifier. (Of course, we don't have ref qualifiers yet.)
if (SCS1.RRefBinding != SCS2.RRefBinding)
return SCS1.RRefBinding ? ImplicitConversionSequence::Better
: ImplicitConversionSequence::Worse;
Added: cfe/trunk/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp?rev=123979&view=auto
==============================================================================
--- cfe/trunk/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp (added)
+++ cfe/trunk/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp Fri Jan 21 10:48:38 2011
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -std=c++0x -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 set.
+#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
+}
More information about the cfe-commits
mailing list