================ @@ -14578,21 +14578,51 @@ ExprResult Sema::CreateBuiltinBinOp(SourceLocation OpLoc, BinaryOperatorKind Opc, Expr *LHSExpr, Expr *RHSExpr) { if (getLangOpts().CPlusPlus11 && isa<InitListExpr>(RHSExpr)) { - // The syntax only allows initializer lists on the RHS of assignment, - // so we don't need to worry about accepting invalid code for - // non-assignment operators. - // C++11 5.17p9: - // The meaning of x = {v} [...] is that of x = T(v) [...]. The meaning - // of x = {} is x = T(). - InitializationKind Kind = InitializationKind::CreateDirectList( - RHSExpr->getBeginLoc(), RHSExpr->getBeginLoc(), RHSExpr->getEndLoc()); + // C++11 [expr.ass]p9, per CWG2768: + // A braced-init-list B may appear on the right-hand side of + // - an assignment to a scalar of type T, in which case B shall have at + // most a single element. The meaning of x = B is x = t, where t is an + // invented temporary variable declared and initialized as T t = B. + if (Opc != BO_Assign) { ---------------- shafik wrote:
So did this check somehow fallout of the old way of doing this or this an additional check? Do we have tests for this, I don't see any tests checking for this explicitly. https://github.com/llvm/llvm-project/pull/100548 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits