473,805 Members | 1,981 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

use of undefined types

class Cfoo {

class Innerfoo;

typedef Innerfoo::Type1 Type1; // error: use of undefined type

Cfoo::Innerfoo: :Type1 bar; // error: use of undefined type
};

class Cfoo::Innerfoo {

typedef int Type1;
};

My understanding of the standard was that you can use undefined types in
declarations. The GCC agrees (no errors) but the VC++ compiler doesn't
(error messages as above). Who is right? I want to write compiler
independ code dammit.
Jun 27 '08 #1
2 2249
Steffen Hampel wrote:
class Cfoo {

class Innerfoo;

typedef Innerfoo::Type1 Type1; // error: use of undefined type

Cfoo::Innerfoo: :Type1 bar; // error: use of undefined type
};

class Cfoo::Innerfoo {

typedef int Type1;
};

My understanding of the standard was that you can use undefined types in
declarations. The GCC agrees (no errors) but the VC++ compiler doesn't
(error messages as above). Who is right? I want to write compiler
independ code dammit.
Try this:

class Cfoo {

class Innerfoo{
typedef int Type1;
};

typedef Innerfoo::Type1 Type1; // error: use of undefined type

Cfoo::Innerfoo: :Type1 bar; // error: use of undefined type
};
Jun 27 '08 #2
On May 22, 10:17 pm, Steffen Hampel <steffen.ham... @s2000.tu-
chemnitz.dewrot e:
class Cfoo {
class Innerfoo;
typedef Innerfoo::Type1 Type1; // error: use of undefined type
Cfoo::Innerfoo: :Type1 bar; // error: use of undefined type
};
class Cfoo::Innerfoo {
typedef int Type1;
};
My understanding of the standard was that you can use
undefined types in declarations.
You can never use an undeclared symbol, period. There are
certain contexts where you can use an incomplete type, but the
symbol naming the type must be in scope. (In the first case
above, an incomplete type would be acceptable; in the second
no.)
The GCC agrees (no errors) but the VC++ compiler doesn't
(error messages as above).
The code is definitely wrong, and I get an error from both g++
and Sun CC.

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Jun 27 '08 #3

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

Similar topics

24
1616
by: DaKoadMunky | last post by:
I was recently reading an article about sequence points that used the canonical i = i++; as an illustration of modifying a variable multiple times between sequence points. Curiously the article did not indicate the type of i. Is it fair to say that if i was an instance of a class type that overloaded
13
3113
by: Jakob Bieling | last post by:
Hi, I am trying to determine the endianness of the system as follows: int i = 1; bool is_little = *reinterpret_cast <char*> (&i) != 0; But now I was asking myself, if this use of reinterpret_cast is valid, according to the Standard.
66
3079
by: Mantorok Redgormor | last post by:
#include <stdio.h> struct foo { int example; struct bar *ptr; }; int main(void) { struct foo baz; baz.ptr = NULL; /* Undefined behavior? */ return 0;
0
1779
by: Chris Fink | last post by:
When I am consuming a webservice, an object has an undefined value (inq3Type.Call3Data). I do not completely understand why this is happening and apologize for the vague question. My assumption is that the WSDL is defined incorrectly and .NET cannot parse the types. Any help is greatly appreciated! CustDDGSvc ws = new CustDDGSvc(); ws.Url = "http://dmapfra003.decisionone.com:8080/JISOAP/CustDDGSvc"; // don't understand why the...
1
4918
by: Justin Johnson | last post by:
Hello, I'm trying to build Python 2.5.0 on AIX 5.3 using IBM's compiler (VisualAge C++ Professional / C for AIX Compiler, Version 6). I run configure and make, but makes fails with undefined symbols. See the output from configure and make below. svnadm /svn/build/python-2.5.0>env CC=cc CXX=xlC ./configure --prefix=$base_dir \ checking MACHDEP... aix5
12
5685
by: Franz Hose | last post by:
the following program, when compiled with gcc and '-std=c99', gcc says test.c:6: error: jump into scope of identifier with variably modified type that is, it does not even compile. lcc-win32, on the other hand, reports Warning test.c: 7 unreachable code
10
1807
by: subramanian100in | last post by:
Consider the following code: #include <iostream> #include <cstdlib> using namespace std; int main() { const double& ref = 100;
22
2034
by: blargg | last post by:
Does ~0 yield undefined behavior? C++03 section 5 paragraph 5 seems to suggest so: The description of unary ~ (C++03 section 5.3.1 paragraph 8): But perhaps "one's complement" means the value that type would have with all bits inverted, rather than the mathematical result of inverting all bits in the binary representation. For example, on a machine with 32-bit
33
2849
by: coolguyaroundyou | last post by:
Will the following statement invoke undefined behavior : a^=b,b^=a,a^=b ; given that a and b are of int-type ?? Be cautious, I have not written a^=b^=a^=b ; which, of course, is undefined. I am having some confusion with the former statement! Also, state the reason for the statement being undefined!
1
10366
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10105
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 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...
0
9185
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, 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...
0
6876
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5542
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...
0
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4323
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
2
3845
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3007
bsmnconsultancy
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...

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.