http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52985
--- Comment #2 from Will Benfold <will at benfold dot com> 2012-04-18 18:08:16
UTC ---
Another test case; this one doesn't need any headers and also cuts out the
loop. The exit status should always be 1, but in fact it's 0 if no
command-line args are supplied and 1 otherwise.
----------------------------------------------------------------
struct Counter
{
Counter (int val = 0)
: m_val(val)
{}
int operator* () const
{
return m_val;
}
Counter operator++ (int)
{
return Counter(m_val++);
}
int m_val;
};
int main (int argc, char *[])
{
int a[] = {0};
int b[] = {0};
Counter c;
((argc > 1) ? a : b)[*c++];
return *c;
}