c++/9310: FD_ZERO etc. macros give strange errors with templates

joona.kiiski@iki.fi joona.kiiski@iki.fi
Tue Jan 14 16:28:00 GMT 2003


>Number:         9310
>Category:       c++
>Synopsis:       FD_ZERO etc. macros give strange errors with templates
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 14 08:16:02 PST 2003
>Closed-Date:
>Last-Modified:
>Originator:     joona.kiiski@iki.fi
>Release:        g++ 2.95.4
>Organization:
>Environment:
Unix / Debian unstable
>Description:
#include <sys/select.h>
using namespace std;

template <class Type>
class myclass1
{
  public:
    void test()
    { 
      fd_set myfs;
      FD_ZERO(&myfs);
    }
};

struct dum {};

int main()
{
  myclass1<dum> temp;
  temp.test();
}
>How-To-Repeat:
Compile code above. Note this works fine with g++ 3.0 and higher, but not with 2.95.4. I got this error message:

g++    -c -o main.o main.cc
main.cc: In method `void myclass1<dum>::test()':
main.cc:20:   instantiated from here
main.cc:11: `volatile' undeclared (first use this function)
main.cc:11: (Each undeclared identifier is reported only once
main.cc:11: for each function it appears in.)
main.cc:11: warning:  qualifier ignored on asm
make: *** [main.o] Error 1
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list