Created on 2013-11-12.00:00:00 last changed 94 months ago
[Moved to DR at the November, 2014 meeting.]
Proposed resolution (February, 2014):
Change 13.10.3 [temp.deduct] paragraph 9 as follows:
Except as described above, the use of an invalid value shall not cause type deduction to fail.[Example: In the following example,1000 is converted to signed char and results in an implementation-defined value as specified in (7.3.9 [conv.integral]). In other words, both templates are considered even though 1000, when converted to signed char, results in an implementation-defined valueassuming a signed char cannot represent the value 1000, a narrowing conversion would be required to convert the template-argument of type int to signed char, therefore substitution fails for the second template (13.4.3 [temp.arg.nontype])..template <int> int f(int); template <signed char> int f(int); int i1 = f<1000>(0); //ambiguousOK int i2 = f<1000>(0); // ambiguous; not narrowing—end example]
13.10.3 [temp.deduct] paragraph 9 reads,
Except as described above, the use of an invalid value shall not cause type deduction to fail. [Example: In the following example 1000 is converted to signed char and results in an implementation-defined value as specified in (7.3.9 [conv.integral]). In other words, both templates are considered even though 1000, when converted to signed char, results in an implementation-defined value.
template <int> int f(int); template <signed char> int f(int); int i1 = f<1>(0); // ambiguous int i2 = f<1000>(0); // ambiguous—end example]
This is no longer correct, even ignoring the fact that some implementations may be able to represent the value 1000 as a signed char: integral and enumeration non-type template arguments are now converted constant expressions (13.4.3 [temp.arg.nontype] paragraph 1), and converted constant expressions disallow narrowing conversions (7.7 [expr.const] paragraph 3).
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-02-06 00:00:00 | admin | set | status: drwp -> cd4 |
2015-05-25 00:00:00 | admin | set | status: dr -> drwp |
2015-04-13 00:00:00 | admin | set | messages: + msg5417 |
2014-11-24 00:00:00 | admin | set | status: ready -> dr |
2014-03-03 00:00:00 | admin | set | messages: + msg4855 |
2014-03-03 00:00:00 | admin | set | status: open -> ready |
2013-11-12 00:00:00 | admin | create |