The following program does not link:

#include <iostream>

class A {
 public:
   static bool const volatile doit = true;
};

using namespace std;

int main()
{
  if( A::doit ) cout << "doit is <true>";
  else cout << "doit is <false>";
}


The link error is:

$ g++ -o mytest mytest.cc
/tmp/ccdPkdpO.o: In function `main':
/tmp/ccdPkdpO.o(.text+0x11): undefined reference to `A::doit'
collect2: ld returned 1 exit status


If volatile is removed, everything works.


-- 
           Summary: static const volatile variables don't get linked
                    correctly
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: zickzack at w84u dot org


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

Reply via email to