This is the mail archive of the gcc-prs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c++/9048: Conditional expression error with static const members


>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]