[PATCH] D60570: [Sema] Add more tests for the behavior of argument-dependent name lookup
Bruno Ricci via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 15 06:23:16 PDT 2019
riccibruno marked 2 inline comments as done.
riccibruno added a comment.
(I have numbered your examples to make the discussion easier, and moved to a non-inline comment to have more space)
foo(ft_t<N::T>); // OK: ADL considers N::foo (nobody but GCC implements this) #1
foo(vt_t<N::T>); // Error: ADL does not consider N::foo #2
foo(ft_t<N::A>); // Error: ADL does not consider N::foo #3
foo(vt_t<N::A>); // Error: ADL does not consider N::foo #4
foo(ft_nt<N::V>); // Error: ADL does not consider N::foo #5
foo(vt_nt<N::V>); // Error: ADL does not consider N::foo #6
foo(vt_nt<N::F>); // Error: ADL does not consider N::foo #7
foo(ft_tt<N::TT>); // OK: ADL considers N::foo (nobody but GCC implements this) #8
foo(vt_tt<N::TT>); // Error: ADL does not consider N::foo #9
foo(ft_tt<N::AT>); // OK: ADL considers N::foo (nobody but GCC implements this) #10
foo( (ft_t<N::T>) ); // OK??: ADL considers N::foo (nobody but GCC implements this) #11
foo( &ft_t<N::T> ); // OK??: ADL considers N::foo (nobody but GCC implements this) #12
foo( (ft_tt<N::TT>) ); // OK??: ADL considers N::foo (nobody but GCC implements this) #13
foo( &ft_tt<N::TT> ); // OK??: ADL considers N::foo (nobody but GCC implements this) #14
foo( (ft_tt<N::AT>) ); // OK??: ADL considers N::foo (nobody but GCC implements this) #15
foo( &ft_tt<N::AT> ); // OK??: ADL considers N::foo (nobody but GCC implements this) #16
I am sympathetic to your concerns about having consistent rules for ADL in these examples. However I am not sure that the conclusion here is to ban them.
First I believe that the examples #11-#16 are just variations of the previous examples because of [over.over]p1: `The overloaded function name can be preceded by the & operator. [...]`.
The examples involving a variable template are currently not supported, but it may be just because it is omitted from the list of ADL rules ? It might be worth filing an issue asking for clarification about this case. WDYT ? (In general I have noticed that variable templates are rarely mentioned in the standard).
The examples #3, #4 are a consequence of the fact that builtin types have no associated namespaces and classes. But this is something that is consistent; just use a class type instead if ADL is intended to be used. Similarly the examples #5. #6, and #7 are consistent; for now, don't rely on ADL with NTTPs (similarly perhaps this case should also be included in the ADL rules since C++20 will allow class types as NTTPs ? I did not see any discussion about this issue in P0732r2.)
Repository:
rC Clang
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60570/new/
https://reviews.llvm.org/D60570
More information about the cfe-commits
mailing list