the following code:
template <class T>
class test{
typedef T::XXX x;
};
int main(){
return 0;
}
Cant be compiled by mingw (but can by borland c++ 5.5) .
Cant gcc support this ? 7 1773
William.Zhang wrote: template <class T> class test{ typedef T::XXX x; };
int main(){ return 0; }
Cant be compiled by mingw (but can by borland c++ 5.5) . Cant gcc support this ?
What error message do you get? What line does it point to?
I don't fully understand 'typename', but you can try that instead of
'class'...
--
Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
William.Zhang wrote: the following code:
template <class T> class test{ typedef T::XXX x;
change to typedef typename T::XXX x;
};
int main(){ return 0; }
Cant be compiled by mingw (but can by borland c++ 5.5) . Cant gcc support this ?
In my opinion, it shouldn't be compiling an unused template...
--
Ian Collins.
William.Zhang wrote: the following code:
template <class T> class test{ typedef T::XXX x;
This should read:
typedef typename T::XXX x;
The compiler is not entitled to assume that T::XXX is a typename, so it has
to be told.
};
int main(){ return 0; }
Cant be compiled by mingw (but can by borland c++ 5.5) . Cant gcc support this ?
Your code is in error, g++ is correct.
Best
Kai-Uwe Bux
Ian Collins wrote: William.Zhang wrote: Cant be compiled by mingw (but can by borland c++ 5.5) . Cant gcc support this ? In my opinion, it shouldn't be compiling an unused template...
Yeah, that's a pretty serious violation of the standard.
this is OK:
typedef typename T::XXX x;
gcc is strict to c++.
"Phlip" <ph******@yahoo .com> дÈëÏûÏ¢ÐÂÎÅ:JC *************** ****@newssvr21. news.prodigy.co m... William.Zhang wrote:
template <class T> class test{ typedef T::XXX x; };
int main(){ return 0; }
Cant be compiled by mingw (but can by borland c++ 5.5) . Cant gcc support this ?
What error message do you get? What line does it point to?
I don't fully understand 'typename', but you can try that instead of 'class'...
-- Phlip http://c2.com/cgi/wiki?ZeekLand <-- NOT a blog!!!
Noah Roberts wrote: Ian Collins wrote: William.Zhang wrote:
Cant be compiled by mingw (but can by borland c++ 5.5) . Cant gcc support this ? In my opinion, it shouldn't be compiling an unused template...
Yeah, that's a pretty serious violation of the standard.
Instantiating it would be a violation. Compiling it is mandatory. This
is the reason
we talk about two-phase name lookup for templates, in both phases name
lookup
happens. 'typename' is needed here (as others have shown) because it
tells the
compiler in phase 1 (compilation) what the results of phase 2
(instantiation) will be.
HTH,
Michiel Salters Mi************* @tomtom.com wrote: Noah Roberts wrote:
Ian Collins wrote:
William.Zhan g wrote:
Cant be compiled by mingw (but can by borland c++ 5.5) . Cant gcc support this ?
In my opinion, it shouldn't be compiling an unused template...
Yeah, that's a pretty serious violation of the standard.
Instantiating it would be a violation. Compiling it is mandatory. This is the reason we talk about two-phase name lookup for templates, in both phases name lookup happens. 'typename' is needed here (as others have shown) because it tells the compiler in phase 1 (compilation) what the results of phase 2 (instantiation) will be.
Can you point me at the appropriate part of the standard? I've never
been 100% sure what the compiler should do with unused templates, beyond
checking they are well formed.
--
Ian Collins. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Uwe Mayer |
last post by:
Hi,
I want do use liburl to scan a webpage which is only accessible from within
my LAN environment. While mozilla manages to load the target URL properly
neither wget, nor liburl or liburl2 does.
I had a closer look at the html source and discovered a lot of Javascript,
including Cookies.
My suspicion is that the Javascript code needs to be executed for the page
to work properly. Also I don't know how liburl deals with Cookies, but
|
by: Lasse Edsvik |
last post by:
can you guys please tell me why i cant use currency as a name in my
querystring?
note: i NEED to use it since i'll be linking to a remote site were they get
that info from querystring
<%
curr="SEK"
%>
<html>
|
by: Scott Townsend |
last post by:
We are trying to get the Microsoft ASPFileUpload to work on both Win2003
and Win2000
http://support.microsoft.com/default.aspx?scid=kb;en-us;q299692
We can now get large and small files on our Development machine. (Win2003
IIS6) Though now that we have posted it to the Production server we cant
seems to upload small files. The Production machine is a Win2000 IIS5
machine. It can take large files just fine. The Small files are what...
|
by: andrewcw |
last post by:
I am building the basic windows service, but on my tool
box tab , there are no components, just clipboard Ring,l
pointer & general. But the MSDN article Dec 2001 by
Getz, "windows services: New base Classes in .NET make
writing a Windows Service Easy" says it should be there.
What could be wrong ??? I have the service installer
components - added but that interface to add those
components is different. Thanks
|
by: erdem kemer |
last post by:
i cant send mail to yahoo mail or hotmail while i can send my other mail
accounts (pop3)
is it becouse yahoo and hotmail is web-based mail
here is the code
MailMessage mailMsg = new MailMessage();
mailMsg.From = from;
from = from + from;
| |
by: Adam |
last post by:
I have a managed cpp wrapper. Im using this in a native dll as a static
variable. I need to free this library when the dll is done being used. The
perfect place to do this is DllMain for DLL_PROCESS_DETACH, but I can't do
this when touching managed code, even if its just calling "delete
someObject;". Any recommendations on how to free this object (it needs to be
freed when the dll is being unloaded from its caller). Since the CRT is...
|
by: Michael Evanchik |
last post by:
Im not getting any error messages but the event is not going off when
i click the button it just posts back to the same page. I know this
code has worked outside of Calanders with the same code. Anyone have
any ideas?
While rdz.Read()
lb(rdz("id")) = New Button
lb(rdz("id")).ID = "lb" & rdz("id")
lb(rdz("id")).Text = rdz("lloyds_num")
AddHandler lb(rdz("id")).Click, AddressOf dayclickz
|
by: Tony Lewis |
last post by:
I'm running IIS on a Windows 2k server and have just installed the .NET
framework 1.1 so I can deploy ASP.NET applications on my server through .NET
Studios. All my normal ASP applications run fine in IIS but I can't run any
ASP.NET pages. Everything in IIS was configured to handle the .aspx file
extension by the .NET framework installation and it installed with no
errors. When I try to view a simple ASP.NET page through a web browser I...
|
by: erotikaboi |
last post by:
Guys, Firstly let me say I am a photographer so if you can offer me a solution I will really appreciate it in simple english not techiespeak as I wont understand it. Thanks.
Ok, I am using Access from the Office XP suite on a pentium 4 running WinXP Home. We have a database which has been running successfully for approx 12 months now. Suddenly when I tried to generate a report or query using a wizard I get the mssg "Active X cant create...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |