Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
20 Views

__is_empty() recognizes empty unions

Hi,
The following code works fine
[cpp]#include 
union empty_union { };

int main()
{
  assert(__is_empty(empty_union));
  return 0;
}[/cpp]
However, according to the latest ISO C++ 0x draft, std::is_empty should not recognize empty unions. GCC's __is_empty does not recognize empty unions as well.
Is this intentional or a bug?
Thanks
0 Kudos
3 Replies
Highlighted
New Contributor II
20 Views

I hope you compiled with g++ 4.3.x and later, as probably __is_empty does not work (and is not recognized and gives error) with 4.2.x or lower, could be due to c++0x features and functions.

I reproduced your problem, the icc & gcc give different result with __is_empty .

I would escalate it as a bug.

regards
0 Kudos
Highlighted
Beginner
20 Views

I hope you compiled with g++ 4.3.x and later, as probably __is_empty does not work (and is not recognized and gives error) with 4.2.x or lower, could be due to c++0x features and functions.

I reproduced your problem, the icc & gcc give different result with __is_empty .

I would escalate it as a bug.

regards

I used gcc 4.4.4
0 Kudos
Highlighted
New Contributor II
20 Views

yes, i meant g++ 4.3.x or later, and that includes g++ 4.4.4, so It should be escalated and fixed.
0 Kudos