LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-12-2004, 03:40 AM   #1
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
Implicit typename warning (gcc 3.3.4)


I have the following code (trimmed up quite a bit, however it still compiles) that gives me two compiler warnings. The warnings talk about implicit typename. AFAIK, it does not affect the performance of the structure, however I like to cut back on the warnings so it is easier to see if there is an important one in there. BTW using 'typename' before 'const I_CELL <Iterator> ::Type' gives an error.


//Header------------------------------------------------------------------------
#include <iterator>

template <class>
class I_CELL;

template <class Type>
class CELL
{
Type
OBJ;
//Object

template <class Iterator> friend class I_CELL;
//Friend class
};

template <class Iterator>
class I_CELL :
public CELL <Iterator>
{
typedef typename std::iterator_traits <Iterator> ::value_type Type;
//Typedef for value type

operator const Type&();
//Conversion operator
};
//------------------------------------------------------------------------------

//Source------------------------------------------------------------------------
template <class Iterator> I_CELL <Iterator> ::
operator const I_CELL <Iterator> ::Type&()
//Conversion operator
{ return *CELL <Iterator> ::OBJ; }
//------------------------------------------------------------------------------


When compiling with gcc 3.3.4, I get the following warnings, implicating the line with 'operator const I_CELL <Iterator> ::Type&()':


*/[...]: warning: ` BC::I_CELL<Iterator>::Type' is implicitly a typename
*/[...]: warning: implicit typename is deprecated, please see the documentation for details


Is there a way to correct this? Not sure what I am doing wrong here. Thanks.
ta0kira
 
Old 10-12-2004, 03:45 AM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Original Poster
Rep: Reputation: Disabled
Sorry, just noticed after I posted; I should use 'typename' AFTER 'const' but BEFORE 'I_CELL <Iterator> ::Type'. Haven't tried it, but if this is the answer and you know it, please laugh at me. If not, laugh at me anyway, and also please give an answer. Thanks.
ta0kira
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
warning: implicit declaration of function liguorir Linux - Software 5 10-22-2012 03:20 PM
warning: incompatible implicit declaration of built-in function ‘exit’ xzotech Programming 1 08-14-2005 05:43 AM
gcc 3.4.1 and c implicit declaration foo_bar_foo Programming 1 01-27-2005 04:49 PM
gcc warning compiling C code vose Programming 2 09-29-2004 10:58 AM
Using typename kamransoomro84 Programming 7 07-14-2004 04:09 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration