This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/9048: Conditional expression error with static const members
- From: jmc at xisl dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 23 Dec 2002 22:29:32 -0000
- Subject: c++/9048: Conditional expression error with static const members
- Reply-to: jmc at xisl dot com
>Number: 9048
>Category: c++
>Synopsis: Conditional expression error with static const members
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Mon Dec 23 14:36:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: John Collins
>Release: g++-3.2 (GCC) 3.2 and all previous versions
>Organization:
>Environment:
Mandrake Linux 9.0 3.2-1mdk
>Description:
class foo {
int some_members; //.....
public:
static const int bar1 = 1, bar2 = 2;
int some_other_members; // ....
};
int main()
{
int x = 1;
// This line causes a complaint about undefined
// "foo::bar1" and "foo::bar2"
int y = x? foo::bar1: foo::bar2;
int z;
// This does what I expect
if (x)
z = foo::bar1;
else
z = foo::bar2;
return 0;
}
>How-To-Repeat:
>Fix:
If using static const members avoid ?: operator.
>Release-Note:
>Audit-Trail:
>Unformatted: