Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Daniel Krügler<daniel.kruegler@googlemail.com> |
|---|---|
| Newsgroups | comp.std.c++ |
| Subject | Re: Defect report: integral-to-boolean conversion in converted constant expressions |
| Date | 2011-10-25 09:59 -0700 |
| Organization | A noiseless patient Spider |
| Message-ID | <j84bbh$kq7$2@dont-email.me> (permalink) |
| References | <37779.10.0.7.178.1319061824.squirrel@webmail.secure.aluminati.net> |
Am 20.10.2011 00:24, schrieb Richard Smith:
> Hi,
>
> In both C++98 and C++11, the following code appears to be ill-formed:
>
> template<bool b> struct S {};
> S<0> s;
>
> However, EDG, g++ and clang all accept it. The reason this is ill-formed is
> that the non-type template argument is a converted constant expression of type
> 'bool' (see [temp.arg.nontype]p5), and the second conversion in the implicit
> conversion sequence is a boolean conversion, which is not allowed in the
> conversion for a converted constant expression (see [expr.const]p3).
> Conversions in the other direction (from 'bool' to integer types) are
> permitted here, since they're integral promotions.
>
> Suggested resolution: In [expr.const]p3, add "boolean conversions from
> integral or unscoped enumeration type other than narrowing conversions" to the
> list of conversions allowed in a converted constant expression.
Forwarded to CWG.
It seems to me that the actual issue is, whether it is clear or not that
[conv.integral] p4 already implies what you are suggesting here.
Greetings from Bremen,
Daniel Krügler
--
[ comp.std.c++ is moderated. To submit articles, try posting with your ]
[ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html ]
Back to comp.std.c++ | Previous | Next — Previous in thread | Find similar
Defect report: integral-to-boolean conversion in converted constant expressions "Richard Smith"<richard@metafoo.co.uk> - 2011-10-19 15:24 -0700 Re: Defect report: integral-to-boolean conversion in converted constant expressions Daniel Krügler<daniel.kruegler@googlemail.com> - 2011-10-25 09:59 -0700
csiph-web