Boost logo

Boost :

From: Rani Sharoni (rani_sharoni_at_[hidden])
Date: 2003-12-15 09:56:17


Daniel Frey wrote:
> Rani Sharoni wrote:
>>> Just curious:
>>>
>>> struct A;
>>> typedef int test[is_incomplete<A>::value];
>>> struct A {};
>>> typedef int test[!is_incomplete<A>::value];
>>>
>>> Does this work, too? (Can't check it myself currently...)
>>
>> Completing class A yield undefined behavior since the completeness
>> of the type should not affect overload resolution. This makes my
>> implementation undefined by definition :).
>> Nevertheless diagnostic is not required and this is basic
>> "assumption" of the is_incomplete "designers".
>>
>> The above code is also ill-formed since POI in unique in each
>> translation unit.
>
> I didn't asked if it is legal, because I know that it is illegal. The
> question is, whether it works or not. I think the answer to this
> question might teach me something about how compilers work, i.e.
> whether the type information that is used to find a templates
> instantiation contains the completeness of a template parameter or
> not. I guess it
> won't work...
>
> Don't know if this knowledge can be used for anything, but as
> mentioned: I'm just curious... :)

Sorry but I forgot part of the mail.

Note that 4.3.3 beta is now the default version.
Thank you for testing your code with Comeau C/C++!
Tell others about http://www.comeaucomputing.com/tryitout !

Your Comeau C/C++ test results are as follows:

Comeau C/C++ 4.3.3 (Aug 6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:strict errors C++

"ComeauTest.c", line 66: error: the size of an array must be greater than
zero
  typedef int test[!is_incomplete<A>::value];
                   ^

Rani


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk