Skip to content

Commit 93d7a96

Browse files
jensmaurertkoeppe
authored andcommitted
[basic.lookup.unqual] Add examples for conversion-function-ids
1 parent 72855b0 commit 93d7a96

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

source/basic.tex

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1752,6 +1752,33 @@
17521752
If that lookup finds nothing, it undergoes unqualified name lookup;
17531753
in each case, only names
17541754
that denote types or templates whose specializations are types are considered.
1755+
\begin{example}
1756+
\begin{codeblock}
1757+
struct T1 { struct U { int i; }; };
1758+
struct T2 { };
1759+
struct U1 {};
1760+
struct U2 {};
1761+
1762+
struct B {
1763+
using T = T1;
1764+
using U = U1;
1765+
operator U1 T1::*();
1766+
operator U1 T2::*();
1767+
operator U2 T1::*();
1768+
operator U2 T2::*();
1769+
};
1770+
1771+
template<class X, class T>
1772+
int g() {
1773+
using U = U2;
1774+
X().operator U T::*(); // \#1, searches for \tcode{T} in the scope of \tcode{X} first
1775+
X().operator U decltype(T())::*(); // \#2
1776+
return 0;
1777+
}
1778+
int x = g<B, T2>(); // \#1 calls \tcode{B::operator U1 T1::*}
1779+
// \#2 calls \tcode{B::operator U1 T2::*}
1780+
\end{codeblock}
1781+
\end{example}
17551782

17561783
\pnum
17571784
In a friend declaration \grammarterm{declarator}

0 commit comments

Comments
 (0)