riccibruno added a comment.

In D60573#1463569 <https://reviews.llvm.org/D60573#1463569>, @rjmccall wrote:

> Hmm.  Does this never impact code that's just using a locally-defined type 
> within its scope?  I guess if ADL is involved, unqualified lookup must have 
> reached the scope of the innermost namespace, and so it would be searching 
> that namespace anyway.
>
> In that case, I think I'm mollified that the source-compatibility risk is low 
> and we should just unconditionally apply the new rule.  LGTM.


I am not sure about what you mean. It is certainly possible to construct a 
piece of C++11 code which breaks with this patch. A possible example is:

  constexpr int f(void *) { return 1; }
  
  static auto lambda = []() { struct S {} s; return s; };
  using S = decltype(lambda());
  
  template <typename T> void test() {
      constexpr T *p = nullptr;
      static_assert(f(p) == 1, "");
  }
  
  constexpr int f(S *) { return 2; }
  
  template void test<S>();

Clang currently accept this because ADL does not currently find the second 
better matching `f`. After this patch it will be found and the `static_assert` 
will fail (which is the behavior of gcc, and as far as I can tell the specified 
behavior).


Repository:
  rC Clang

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

https://reviews.llvm.org/D60573



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

Reply via email to