c++/2663: enumerations passed through ellipses considered wrong type
psilord@cs.wisc.edu
psilord@cs.wisc.edu
Thu Apr 26 21:36:00 GMT 2001
>Number: 2663
>Category: c++
>Synopsis: enumerations passed through ellipses considered wrong type
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Thu Apr 26 21:36:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Peter K. Keller
>Release: gcc version 3.0 20010426 (prerelease)
>Organization:
>Environment:
CodeSourcery's Online Test Compilation Page
>Description:
I'd like to report a bug in "gcc version 3.0 20010426 (prerelease)" that
was available at the "CodeSourcery's Online Test Compilation" page.
Basically the problem is that g++ does something strange with an enum that
ends up being used in a function that uses the '...' variable arguments
capability of C. For some reason, the compiler thinks the enum isn't an
int-sized quantity and tries to perform some promotion on it. This causes an
error(detailed in part 4 below). I looked around in GNATS, but didn't see
anything related to this bug.
You can just go to:
CodeSourcery's Online Test Compilation Page
and enter the "how to repeat" code to see it break.
Thank you.
-pete
Thank you.
>How-To-Repeat:
#include<stdio.h>
#include<stdlib.h>
#include<limits.h>
#include<stdarg.h>
enum foobar_t { ___foobar_t_dummy_value___ = INT_MAX };
int func(int foo, ...)
{
foobar_t f;
va_list ap;
va_start( ap, foo );
f = va_arg(ap, foobar_t);
va_end(ap);
return 0;
}
int main(void)
{
foobar_t foo;
func(1, foo);
return(0);
}
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list