473,385 Members | 1,372 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,385 software developers and data experts.

Implicit typename, typedefs, and inheritance

Hi all,
I'm working on migrating my code from KCC to gcc, and I'm having some
issues with "implicit typename" warnings from gcc. Essentially, what
happens is described by this example:

template <typename cell_data_type> class cell {};

template <typename a> class c1 {
public:
typedef cell<a> T_cell;
};

template <typename a> class c2 : public c1<a> {
T_cell func();
};

Trying to compile this code, results in this message from gcc:

[40]patrik@rumba:/u/patrik/sunrise/src% g++ -c typename.cc
typename.cc:9: warning: `typename c2<a>::T_cell' is implicitly a
typename
typename.cc:9: warning: implicit typename is deprecated, please see the

documentation for details

I don't understand what is implicit about this type. It's not implicit
in class c1, so how come it's implicit in class c2? The problem is not
correctable by adding typename to the offending line; this results in a
compilation error. Redefining the typedef in c2 removes the warning,
but that makes the idea of public typedefs useless...

Does this behavior makes sense to people?

Thanks,

/Patrik

Jul 23 '05 #1
1 1736
lutorm wrote:
typename.cc:9: warning: implicit typename is deprecated, please see the documentation for details

I don't understand what is implicit about this type. It's not implicit in class c1, so how come it's implicit in class c2? The problem is not correctable by adding typename to the offending line; this results in a compilation error. Redefining the typedef in c2 removes the warning,
but that makes the idea of public typedefs useless...

Does this behavior makes sense to people?


You need to add 'typename' to dependent names. See here for details:
http://womble.decadentplace.org.uk/c...disambiguation
Read also the other FAQs or you get another bunch of errors with the
next gcc release (you probably havn't compiled yet with 3.4).

R.C.

Jul 23 '05 #2

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

Similar topics

1
by: Steve Hill | last post by:
Hi, When compiling under g++ (version 3.2) the following code fragement gives me a warning: steve@khan:~/tmp> /opt/bin/g++ -o state_test state_test.cpp state_test.cpp:42: warning: `typename...
11
by: Johan | last post by:
Hi Can somebody explain to me why I get this warning message and how I can solve this warning message. Thanks a lot Johan In member function `void
1
by: Christophe Poucet | last post by:
Hellom I have an issue with implicit conversions. Apparently when one calls an operator on a class Y which has a conversion operator to class X which has the operator . Sadly it will not do...
3
by: Šimon Tóth | last post by:
Can anybody tell me how to turn of this warning? -Wno-deprecated doesn't work. I don't want to edit the source file, because it works fine and it's a bit hardcore stuff for me :) warning:...
2
by: Levent | last post by:
Please consider the following Parent and Child template classes: template <class T> class Parent { public: typedef T type; typedef T& ref; /* pack of typedefs */ };
1
by: pmatos | last post by:
Hi all, I'm starting to use templates and I just got a weird error which I was able to simplify into this code: #include <vector> using std::vector; template<class T> class foo {
3
by: Generic Usenet Account | last post by:
This is a two-part question. (1) I have implemented a "Datastructure Registry" template class. I am getting no compiler warnings with older compilers, but newer compilers are generating the...
8
by: xuatla | last post by:
Hi, When I compile the following test code I got a warning about implicit typename. This happens in the member functions. Do you know the detail reason and solution? Thanks. - X ----------
18
by: Tony | last post by:
class Interface { public: virtual void DoItNow()=0; }; class A: public Interface { public: void DoItNow(); // satisfies interface explicitly
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...

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.