c++/10086: static const int unresolved in ? : construct
chrisk@mysticlabs.com
chrisk@mysticlabs.com
Fri Mar 14 21:48:00 GMT 2003
>Number: 10086
>Category: c++
>Synopsis: static const int unresolved in ? : construct
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Mar 14 21:36:00 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Chris Kappler
>Release: gcc version 3.2 20020927 (prerelease)
>Organization:
>Environment:
Cygwin
>Description:
const static int variables show up as unresolved in the linker.
>How-To-Repeat:
g++ bug.cpp
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="bug.cpp"
Content-Disposition: inline; filename="bug.cpp"
#include <iostream>
using namespace std;
class Base {
public:
const static int A = 0;
const static int B = 1;
};
class Child : public Base {
public:
void printAB(bool v);
};
void Child::printAB(bool v) {
int a = (v)?A:B;
int b = (v)?A:B;
cout<<"a is "<<a<<" b is "<<b<<endl;
}
int main() {
Child c;
c.printAB(true);
c.printAB(false);
}
More information about the Gcc-bugs
mailing list