|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2003-01-25 10:47:53
On Saturday, January 25, 2003, at 08:39 AM, Peter Dimov wrote:
>> Furthermore, it is undefined to pass a non-pod to an ellipse
>> (5.2.2/7):
>>
>> int foo(...);
>>
>> class B
>> {
>> public:
>> B();
>> private:
>> B(const B&);
>> };
>>
>> int main()
>> {
>> foo(B()); // undefined behavior
>> }
>>
>> If you stick that in a sizeof, it is still undefined:
>>
>> sizeof(foo(B()));
>
> Is it?
>
> 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).
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk