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 |
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.R | Title | User | Personal Name | Date | Lines |
---|---|---|---|---|---|
3480.1 | Noted | DECCXX::AMARTIN | Alan H. Martin | Mon Mar 10 1997 11:18 | 2 |
Sounds like a good idea to me. /AHM | |||||
3480.2 | Is this any better? from v6.0 prototype | WIDTH::MDAVIS | Mark Davis - compiler maniac | Mon Mar 10 1997 12:06 | 12 |
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.3 | better! | MUCTEC::BECKER | Hartmut B., VMS & Languages, Munich | Tue Mar 11 1997 03:58 | 4 |
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.4 | DECC::FOLTAN | Tue Mar 11 1997 12:25 | 5 | ||
Hartmut, Actually this improvement will be coming in DEC C++ V5.6. Thanks for pointing this out to us. |