* implicit typename warnings with gcc 3.1
@ 2002-08-01 5:04 Richard Guenther
2002-08-01 5:20 ` Gabriel Dos Reis
0 siblings, 1 reply; 5+ messages in thread
From: Richard Guenther @ 2002-08-01 5:04 UTC (permalink / raw)
To: gcc
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? Is this a gcc deficiency? Intel C++
doesnt complain here.
Thanx, Richard.
--
Richard Guenther <richard.guenther@uni-tuebingen.de>
WWW: http://www.tat.physik.uni-tuebingen.de/~rguenth/
The GLAME Project: http://www.glame.de/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: implicit typename warnings with gcc 3.1
2002-08-01 5:04 implicit typename warnings with gcc 3.1 Richard Guenther
@ 2002-08-01 5:20 ` Gabriel Dos Reis
2002-08-01 5:24 ` Richard Guenther
2002-08-03 15:30 ` Nix
0 siblings, 2 replies; 5+ messages in thread
From: Gabriel Dos Reis @ 2002-08-01 5:20 UTC (permalink / raw)
To: Richard Guenther; +Cc: gcc
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: implicit typename warnings with gcc 3.1
2002-08-01 5:20 ` Gabriel Dos Reis
@ 2002-08-01 5:24 ` Richard Guenther
2002-08-03 15:30 ` Nix
1 sibling, 0 replies; 5+ messages in thread
From: Richard Guenther @ 2002-08-01 5:24 UTC (permalink / raw)
To: Gabriel Dos Reis; +Cc: gcc
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/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: implicit typename warnings with gcc 3.1
2002-08-01 5:20 ` Gabriel Dos Reis
2002-08-01 5:24 ` Richard Guenther
@ 2002-08-03 15:30 ` Nix
2002-08-03 15:43 ` Gabriel Dos Reis
1 sibling, 1 reply; 5+ messages in thread
From: Nix @ 2002-08-03 15:30 UTC (permalink / raw)
To: Gabriel Dos Reis; +Cc: Richard Guenther, gcc
On Thu, 1 Aug 2002, Gabriel Dos Reis said:
> Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
>| Is this a gcc deficiency?
>
> No. The only deficiency I see is that it doesn't issue a hard error ;-)
I fear that if it issued a hard error about half the C++ code in a
random Linux distro would cease to compile[1] :(
In time, when most people have fixed their code, it can be made an
error; but I'd not do it before that myself.
[1] merely an educated guesstimate
--
`There's something satisfying about killing JWZ over and over again.'
-- 1i, personal communication
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: implicit typename warnings with gcc 3.1
2002-08-03 15:30 ` Nix
@ 2002-08-03 15:43 ` Gabriel Dos Reis
0 siblings, 0 replies; 5+ messages in thread
From: Gabriel Dos Reis @ 2002-08-03 15:43 UTC (permalink / raw)
To: Nix; +Cc: Richard Guenther, gcc
Nix <nix@esperi.demon.co.uk> writes:
| On Thu, 1 Aug 2002, Gabriel Dos Reis said:
| > Richard Guenther <rguenth@tat.physik.uni-tuebingen.de> writes:
| >| Is this a gcc deficiency?
| >
| > No. The only deficiency I see is that it doesn't issue a hard error ;-)
|
| I fear that if it issued a hard error about half the C++ code in a
| random Linux distro would cease to compile[1] :(
I know that. Please note the smiley.
-- Gaby
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2002-08-03 22:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-01 5:04 implicit typename warnings with gcc 3.1 Richard Guenther
2002-08-01 5:20 ` Gabriel Dos Reis
2002-08-01 5:24 ` Richard Guenther
2002-08-03 15:30 ` Nix
2002-08-03 15:43 ` Gabriel Dos Reis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).