|
Boost : |
From: Rani Sharoni (rani_sharoni_at_[hidden])
Date: 2003-12-09 13:41:13
Daniel Frey wrote:
> Rani Sharoni wrote:
>> I accidentally encounter some bug in EDG (latest) that is
>> exploitable for implementing is_incomplete. I personally despise
>> this ODR rebel but I suspect that some really like it.
>
> I was thinking about something similar while fixing checked_delete,
> but refrained from it as violating the ODR seemed to dangerous to me.
> Check the "feature" of some compilers to set the sizeof(T) to 0 for
> incomplete types T. Maybe it works on more compilers than the bug you
> found currently, since some vendors think it's a feature :o)
I suspect that except for EDG no compiler is compliant enough to allow such
abuse :)
I looked at the standard and I'm not sure that it explicitly specifies what
happens in the case that I presented. It's not clear enough that the
built-in operator+ is not removed from the overloading candidate functions
set in this case and maybe it worth a DR.
Here are two more cases that demonstrate the consistency of EDG which is
very impressive:
template<typename T> struct X;
typedef int test[is_incomplete< X<int> >::value];
// function are somehow incomplete types
typedef int test[is_incomplete< void(int) >::value];
Rani
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk