Skip to content

Commit a8d3b41

Browse files
burblebeetkoeppe
authored andcommitted
CWG3190 Ambiguous lookup for type aliases in reflection
1 parent 452a1f5 commit a8d3b41

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

source/expressions.tex

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6836,7 +6836,8 @@
68366836
\end{example}
68376837
\item
68386838
Otherwise, if lookup finds a namespace alias\iref{namespace.alias},
6839-
$R$ represents that namespace alias.
6839+
all declarations found by name lookup shall have the same target scope, and
6840+
$R$ represents the namespace alias.
68406841
\item
68416842
Otherwise, if lookup finds a namespace\iref{basic.namespace},
68426843
$R$ represents that namespace.
@@ -6873,10 +6874,29 @@
68736874
\end{note}
68746875
\end{itemize}
68756876
\item
6876-
Otherwise, if lookup finds a type alias $A$,
6877-
$R$ represents the underlying entity of $A$
6878-
if $A$ was introduced by the declaration of a template parameter;
6879-
otherwise, $R$ represents $A$.
6877+
Otherwise, if lookup finds a type alias:
6878+
\begin{itemize}
6879+
\item
6880+
If any declaration found by name lookup is of a template parameter $T$,
6881+
$R$ represents the underlying entity of $T$.
6882+
\item
6883+
Otherwise,
6884+
all declarations found by name lookup shall have the same target scope, and
6885+
$R$ represents the type alias.
6886+
\end{itemize}
6887+
\begin{example}
6888+
\begin{codeblock}
6889+
namespace A {
6890+
using T = int;
6891+
}
6892+
namespace B {
6893+
using T = int;
6894+
}
6895+
using namespace A;
6896+
using namespace B;
6897+
auto r = ^^T; // error: lookup finds type aliases with different target scopes
6898+
\end{codeblock}
6899+
\end{example}
68806900
\item
68816901
Otherwise, if lookup finds a class or an enumeration,
68826902
$R$ represents the denoted type.

0 commit comments

Comments
 (0)