[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::c_plus_plus

Title:C++
Notice:Read 1.* and use keywords (e.g. SHOW KEY/FULL KIT_CXX_VAX_VMS)
Moderator:DECCXX::AMARTIN
Created:Fri Nov 06 1987
Last Modified:Thu Jun 05 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:3604
Total number of notes:18242

3480.0. "Give name of incomplete template actual type argument" by MUCTEC::BECKER (Hartmut B., VMS & Languages, Munich) Mon Mar 10 1997 07:49

Can we have better diagnostics for templates and incomplete classes?       

From the source you can see that the error is not in line 2 or line 17. It
is caused by Foo<Incomplete> and FooBar<Incomplete>. VC++ does a better job
it names the incomplete classes. This makes it easier to find the real
problem. 
                            
Hartmut

$ type x.cxx
template <class FooType> class Foo {
	FooType	foo;
};

class Incomplete;

class Complete {
	int i;
};

Foo<int> iFoo;
Foo<float> fFoo;
Foo<void*> vFoo;
Foo<Complete> completeFoo;
Foo<Incomplete> incompleteFoo;

template <class FooBarType> class FooBar: public FooBarType {
	int i;
};

FooBar<Complete> completeFooBar;
FooBar<Incomplete> incompleteFooBar;

$ cxx x

        FooType foo;
................^
%CXX-E-INCOMPMEM, The member "foo" has an incomplete type.
at line number 2 in file USER$DISK:[BECKER]X.CXX;4

template <class FooBarType> class FooBar: public FooBarType {
.................................................^
%CXX-E-INCOMPBASE, In this declaration, the incomplete type "FooBarType" is used
 as a base class.
at line number 17 in file USER$DISK:[BECKER]X.CXX;4

$ cxx/ver/noobj nl:
DEC C++ V5.5-017 on OpenVMS Alpha V7.1

T.RTitleUserPersonal
Name
DateLines
3480.1NotedDECCXX::AMARTINAlan H. MartinMon Mar 10 1997 14:182
Sounds like a good idea to me.
				/AHM
3480.2Is this any better? from v6.0 prototypeWIDTH::MDAVISMark Davis - compiler maniacMon Mar 10 1997 15:0612
tagged 146% exx -c ~/c++/cpp3480.cxx
cxx: Error: /usr/users/mdavis/c++/cpp3480.cxx, line 2: incomplete type is not
allowed
          detected during instantiation of class "Foo<Incomplete>" at line 15
        FooType foo;
----------------^
cxx: Error: /usr/users/mdavis/c++/cpp3480.cxx, line 17: incomplete type is not
allowed
          detected during instantiation of class "FooBar<Incomplete>" at line 22
template <class FooBarType> class FooBar: public FooBarType {
-------------------------------------------------^
2 errors detected in the compilation of "/usr/users/mdavis/c++/cpp3480.cxx".
3480.3better!MUCTEC::BECKERHartmut B., VMS &amp; Languages, MunichTue Mar 11 1997 06:584
That's exactly what I'm missing. The reference to the instantiation would
have saved (me and our partner) some time. Now I'm longing for V6. 

Hartmut
3480.4DECC::FOLTANTue Mar 11 1997 15:255
Hartmut,

Actually this improvement will be coming in DEC C++ V5.6.
Thanks for pointing this out to us.