Created on 2010-06-14.00:00:00 last changed 171 months ago
Rationale (November, 2010):
The CWG agreed that this behavior is unfortunate but felt that it would be too difficult to formulate a satisfactory set of rules for handling complex expressions correctly for a small gain in utility (the user can simply add a cast in order to avoid the error).
Consider the example,
struct A { char c; }; void f (char d) { A a = { d + 1 }; }
This code is now ill-formed because of the narrowing conversion from the int result type of the addition, not because of any real narrowing. This seems like an embarrassment for C++0x. It would be better not to get an error about any arithmetic involving non-constant operands just because it might overflow with some values.
History | |||
---|---|---|---|
Date | User | Action | Args |
2010-11-29 00:00:00 | admin | set | messages: + msg3217 |
2010-11-29 00:00:00 | admin | set | status: open -> nad |
2010-06-14 00:00:00 | admin | create |