VisualAge C++ 6 bug?

C

cmwong2

Hi,

I'm trying to use Boost and find that my program doesn't compile in AIX
with VisualAge C++ 6. I tried to simulate the problem by writing a
simple program (see below) and find that it also didn't compile. The
error was "non-type template parameter must be constant integral
expression" in the line "A<f> a;". Is this a bug in VisualAge C++ 6? Is
there any patch available? Thanks.

CM


#include <stdio.h>

template<bool x>
class A
{
public:
void print()
{
printf("%d\n",x);
}
};

template<int n>
class B
{
public:
static const bool f=true;
A<f> a;
void print()
{
a.print();
printf("%d\n", n);
}
};

int main()
{
B<34> b;
b.print();
}
 
P

P.J. Plauger

I'm trying to use Boost and find that my program doesn't compile in AIX
with VisualAge C++ 6. I tried to simulate the problem by writing a
simple program (see below) and find that it also didn't compile. The
error was "non-type template parameter must be constant integral
expression" in the line "A<f> a;". Is this a bug in VisualAge C++ 6? Is
there any patch available? Thanks.

V6 isn't nearly sturdy enough to support most of Boost. (We got things like
regex working for char, but that took some effort.) In particular, you can't
write things like:

static const bool f = true;

at least not all in one line. You have to write:

static const bool f;

and then, outside the class, provide the initializer for it. But it's still
not
usable as a constant integer expression. OTOH:

A<true> a;

ought to work fine. I suspect, however, that you will find many more
problems with Boost code under V6.

BTW, this is not a "bug" in V6. Rather, it's a change in the language
that happened while the C++ Standard was still evolving. V6 froze
partway through the standardization process.

HTH,

P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com
 
J

jjds101

P.J. Plauger said:
V6 isn't nearly sturdy enough to support most of Boost. (We got things like
regex working for char, but that took some effort.) In particular, you can't
write things like:

static const bool f = true;

at least not all in one line. You have to write:

static const bool f;

and then, outside the class, provide the initializer for it. But it's still
not
usable as a constant integer expression. OTOH:

A<true> a;

ought to work fine. I suspect, however, that you will find many more
problems with Boost code under V6.

BTW, this is not a "bug" in V6. Rather, it's a change in the language
that happened while the C++ Standard was still evolving. V6 froze
partway through the standardization process.

Really? Isn't version 6 the latest version of VisualAge C++ for AIX?
It was released in 2004, I believe.
 
C

cmwong2

Anyway, thanks for all the comments. After some hard work, I figured
out that the mentioned problem doesn't exist in the version 6.0.0.10
which is a bit older than the one I'm using (6.0.0.13). So my only
solution maybe to downgrade to that version.

CM


P.J. Plauger ¼g¹D¡G
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,019
Latest member
RoxannaSta

Latest Threads

Top