Narrowing Conversion required while list initialization
问题 I read about narrowing conversion on the cpp reference website. I kind of understood it but what i am not getting is that why is the error present only in the first line. long double ld = 3.1415926536; int a{ld}, b = {ld}; // error: narrowing conversion required int c(ld), d = ld; // ok: but value will be truncated Why is the error only present in first line and not the second? 回答1: Because the compiler is required to issue a diagnostic (in your case error) for narrowing only for list