This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: implicit typename warnings with gcc 3.1


Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:

| Hi!
| 
| template <int i>
| struct foo {
|         typedef int a_t;
| };
| 
| template <int i>
| class blubb : public foo<i>
| {
|         a_t x;
| };
| 
| gives
| 
| bellatrix:~/src/tests$ g++ -c implicit.cpp
| implicit.cpp:10: warning: `typename blubb<i>::a_t' is implicitly a
| typename
| implicit.cpp:10: warning: implicit typename is deprecated, please see the
|    documentation for details
| 
| How am I supposed to fix such cases?

This must be a FAQ.  Dependent base names are not examined during the
first phase of name lookup in template codes.  That means the above
code is ill-formed, since there is no "a_t" in scope. The incriminated
line should read something like: 

   typename foo<i>::a_t x;

| Is this a gcc deficiency? 

No. The only deficiency I see is that it doesn't issue a hard error ;-)

| Intel C++
| doesnt complain here.

Then, it isn't compliant in that regard.

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]