Quuxplusone added inline comments.

================
Comment at: 
test/CXX/basic/basic.lookup/basic.lookup.argdep/p2-associated-namespaces-classes.cpp:304
+    static_assert(f(g3) == 4, "");        // FIXME: Also well-formed from the 
union rule.
+                                          // expected-error@-1 {{use of 
undeclared}}
+  }
----------------
I see how `g3` matches the example in CWG997
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#997
However, I don't see how CWG997's resolution actually affected this example in 
the slightest. The wording inserted for CWG997 was, "Additionally, if the 
aforementioned set of overloaded functions is named with a template-id, its 
associated classes and namespaces are those of its type template-arguments and 
its template template-arguments." That makes e.g.

    f(g3<N::S>)

consider `N::f`, because `N::S` is a "type template-argument" of the 
template-id `g3<N::S>` which names the set of overloaded functions.  But it 
doesn't do anything at all to `f(g3)` because `g3` is not a template-id and 
doesn't have any template-arguments.

This piece of ADL is implemented only by GCC (not EDG, Clang, or MSVC), and 
personally I would very much like to keep it that way. We know there's no 
real-world code that expects or relies on CWG997 — because such code would 
never work in practice except on GCC. Let's keep it that way!  As soon as you 
implement a crazy arcane rule, such that code _could_ portably rely on it, code 
_will start_ relying on it... and then we'll never be able to simplify the 
language.
Case in point: the piece of ADL described in this blog post --
https://quuxplusone.github.io/blog/2019/04/09/adl-insanity-round-2/
As soon as the above-described arcane ADL rule was implemented in GCC and 
Clang, Boost.Hana started relying on it; and now the rule is "locked in" to the 
paper standard because there's real-world code relying on it.
Personally I'd like to _keep_ real-world code from relying on CWG997, until 
someone figures out what CWG was thinking when they added it.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60570/new/

https://reviews.llvm.org/D60570



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to