This is the mail archive of the
gcc-prs@gcc.gnu.org
mailing list for the GCC project.
c++/10086: static const int unresolved in ? : construct
- From: chrisk at mysticlabs dot com
- To: gcc-gnats at gcc dot gnu dot org
- Date: 14 Mar 2003 21:30:05 -0000
- Subject: c++/10086: static const int unresolved in ? : construct
- Reply-to: chrisk at mysticlabs dot com
>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);
}