The following code raise undefined reference link errors:
toto.C:(.text+0x10): undefined reference to `A::a'
toto.C:(.text+0x18): undefined reference to `B::a'

The code:

struct A {
    static const int a = 0;
};

struct B {
    static const int a = 1;
};

int main() {
    bool b = true;
    return b ? A::a : B::a;
}


-- 
           Summary: undefinied reference with static constant initialized
                    data member in conditional expression
           Product: gcc
           Version: 4.4.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: doreille at smr dot ch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44215

Reply via email to