rsmith added inline comments.

================
Comment at: lib/Sema/SemaInit.cpp:7691-7695
   case FK_RValueReferenceBindingToLValue:
     S.Diag(Kind.getLocation(), diag::err_lvalue_to_rvalue_ref)
       << DestType.getNonReferenceType() << Args[0]->getType()
       << Args[0]->getSourceRange();
     break;
----------------
Same problem exists here, and probably in a lot of these diagnostics. For 
example:

 *`int a; int &&b = {a};` says "cannot bind to lvalue of type 'void'")
 * `void f(int); void f() { int &&b = {f}; }` asserts due to not unwrapping the 
`InitListExpr` before trying to diagnose

Can you try to address this more generally? Perhaps: add an `Expr *OnlyArg`, 
which is null if `Args.size() != 1`, is the list element if `Args.size() == 1` 
and is an `InitListExpr` with a single element, and is otherwise `Args[0]`, and 
change all the diagnostics that are talking about a one-and-only argument to 
use `OnlyArg`?


https://reviews.llvm.org/D39679



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
  • [PATCH] D39679: [... Nicolas Lesser via Phabricator via cfe-commits
    • [PATCH] D396... Richard Smith - zygoloid via Phabricator via cfe-commits

Reply via email to