473,395 Members | 1,742 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

problem with g++-4.2 and g++-4.1

Hi,

Can anyone tell the reason why the following code can be compiled
using g++-4.1 while g++-4.2 throws a compilation error?

template<class A, class B = int>
class foo{
public:
A i;
B j;
};

template<class A = int, template<class>class B = foo>
class bar : public B<A>{
public:
A k;
};

int main(){
bar<test;

test.k = test.j = test.i = 0;

return 0;
}

Oct 15 '07 #1
1 1406
On Oct 15, 11:03 am, Alpha <xinhaoy...@gmail.comwrote:
Hi,

Can anyone tell the reason why the following code can be compiled
using g++-4.1 while g++-4.2 throws a compilation error?

template<class A, class B = int>
class foo{
public:
A i;
B j;

};

template<class A = int, template<class>class B = foo>
template <class A=int, template <class, class=int>class B = foo>

Thats the right way.
class bar : public B<A>{
public:
A k;

};

int main(){
bar<test;

test.k = test.j = test.i = 0;

return 0;

}
-N

Oct 15 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Befuddled | last post by:
Forgive me, this is probably a very simple problem, but it's new to me. When I attempt to make php 4.3.8, it exits, and I believe the relevant message is: libtool: link: cannot find the library...
0
by: Hegemony Cricket | last post by:
Trying to run Java programs on the Mac (OS X 10.2.8, G4). From the command line, any time my program tries to pop up a window, nothing appears. I just get a "wait" cursor. Thought it was some...
5
by: scott | last post by:
First my setup: I'm using the framework build of Python 2.4.1 ( http://bob.pythonmac.org/archives/2005/03/31/macpython-241-installer/ ) on an ibook G4 running Mac OS 10.3.8. I installed...
4
by: Richard Cavell | last post by:
Hi, I wish to write an algorithm in C++. My intention is to run it on a Mac G4, however it would be nice to have the same program compile and run on a Pentium 4. The program will have to do...
3
by: Fabio Garufi | last post by:
Hi, all, I built the fftw-3.0.1-fma on a LynxOS 4.0 running on a board equipped with a PowerPC G4 7457. To compile it I had to slightly modify the configure script to use the -fvec instead of...
1
by: JSheble | last post by:
I need to save a bitmap object as a G4 Compressed TIF file... any help would be tremendously appreciated...
3
by: Joe | last post by:
Hi, I am creating a sudoku on VB Dot Net but to set all textboxes to its standard I have this code below. I want to set this in an array but I don't know how to work with arrays. Could someone...
0
by: a3355776 | last post by:
On my Mac, the Tk Canvas arc drawing routine produces arcs that are rotated quite a few degrees from their correct location (as many as 10 deg.). It doesn't seem to be a consistent amount though, but...
1
by: Andrea | last post by:
Hi all! Can anyone help me how to communicate with devices connected to I2C bus on powerbook G4? API or example source code? Very thanks!
0
by: buntybutt | last post by:
I have Apple iBook G4. Some how I forgot its Login Name and Password. I have Max OS Install Disc 1, 2, 3 & Software Restore Disc 1, 2, 3 & 4. I tried alot to re install the OS with it but it would...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.