implicit typename warnings with gcc 3.1
Richard Guenther
rguenth@tat.physik.uni-tuebingen.de
Thu Aug 1 05:24:00 GMT 2002
On 1 Aug 2002, Gabriel Dos Reis wrote:
> 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;
--
Richard Guenther <richard.guenther@uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
The GLAME Project: http://www.glame.de/
More information about the Gcc
mailing list