|
Boost : |
From: David Abrahams (dave_at_[hidden])
Date: 2003-01-25 19:17:35
Howard Hinnant <hinnant_at_[hidden]> writes:
> On Saturday, January 25, 2003, at 08:39 AM, Peter Dimov wrote:
>
>> if(false) foo(B());
>>
>> Is this undefined too?
>
> <shrug> That's the way I read 5.2.2/7. I see little
> difference between that example and:
>
> class B
> {
> int foo();
> };
>
> int main()
> {
> B b;
> if (false)
> b.foo();
> }
>
> Except in the latter a diagnostic is required, whereas
> a diagnostic is not required, only permitted in the
> former.
>
> I'm open to other interpretations. Note that 1.3.12
> defines undefined behavior, and specifically includes a
> compile time diagnostic and termination of compilation
> as possible consequences of undefined behavior
> (i.e. undefined behavior includes compile time
> behavior, not just run time behavior).
It's hard for me to justify any other interpretations under a strict
reading of the standard. I am tempted to open a DR about this, but
I'm not sure exactly how much we should ask for. Shooting for the
moon, we could ask that an expression can only invoke undefined
behavior if it is "potentially evaluated", c.f. 3.2/2
-- David Abrahams dave_at_[hidden] * http://www.boost-consulting.com Boost support, enhancements, training, and commercial distribution
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk