[cfe-dev] Q on patch for CWG 2352

Robinson, Paul via cfe-dev cfe-dev at lists.llvm.org
Wed Mar 4 12:56:49 PST 2020


Richard Smith made a patch in f041e9ad for CWG2352.
As a consequence of this patch, we had an obscure test failure,
and it's not clear to me that it's an intentional consequence.
So I figured I'd ask here.

Reduced test case:

bool foo(void * const * const *       &&) { return false; }
bool foo(void *       * const * const &)  { return true; }
bool bar() {
  return foo(reinterpret_cast<void***>(2));
}

Prior to the patch, the compiler selected the second overload;
after the patch, it selects the first overload.  Apparently there's
some subtle difference in the preferred-ness of one over the other,
and AFAICT the const-nesses aren't supposed to factor in any more?
so it's about the &-ref versus the &&-ref?

As I said, mainly I want to make sure this was intentional; if it
is, we can fiddle our test and that's the end of it.  But if it's
not intentional, this change is in the almost-final Clang 10.0
release, and might want to be fixed before it goes out.

Thanks,
--paulr



More information about the cfe-dev mailing list