--- Comment #7 from pinskia at gcc dot gnu dot org 2008-03-30 20:45 ---
With -Wextra (aka -W), we get a warning now:
t.cc:1: warning: type qualifiers ignored on function return type
So closing as fixed.
--
pinskia at gcc dot gnu dot org changed:
What|Removed
--- Comment #6 from bangerth at dealii dot org 2005-11-23 05:25 ---
Given the literal meaning of the word void, it is amusing to think
about what one might want to mean when one says const void...
--
bangerth at dealii dot org changed:
What|Removed
--- Comment #1 from gdr at integrable-solutions dot net 2005-11-22 02:46
---
Subject: Re: New: Needs a warning?
igodard at pacbell dot net [EMAIL PROTECTED] writes:
| struct foo { const void f(); };
| void foo::f(){}
|
| gets you:
|
| ~/ootbc/members/src$ g++ foo.cc -Wall
|
--- Comment #2 from pinskia at gcc dot gnu dot org 2005-11-22 03:01 ---
Different versions give different diagnostics:
earth:~gcc t.cc
t.cc:2: error: prototype for 'void foo::f()' does not match any in class 'foo'
t.cc:1: error: candidate is: const void foo::f()
t.cc:2: error: 'void
--- Comment #3 from igodard at pacbell dot net 2005-11-22 03:45 ---
The 3.0 is the best error, but I like the warning that comeau also gives:
Comeau C/C++ 4.3.3 (Aug 6 2003 15:13:37) for ONLINE_EVALUATION_BETA1
Copyright 1988-2003 Comeau Computing. All rights reserved.
MODE:strict
pinskia at gcc dot gnu dot org [EMAIL PROTECTED] writes:
| earth:~~/ia32_linux_gcc3_0/bin/gcc t.cc
| t.cc:2: prototype for `void foo::f()' does not match any in class `foo'
| t.cc:1: candidate is: const void foo::f()
| earth:~~/ia32_linux_gcc2_95//bin/gcc t.cc
| t.cc:2: new declaration `void
--- Comment #4 from gdr at integrable-solutions dot net 2005-11-22 03:58
---
Subject: Re: Needs a warning?
pinskia at gcc dot gnu dot org [EMAIL PROTECTED] writes:
| earth:~~/ia32_linux_gcc3_0/bin/gcc t.cc
| t.cc:2: prototype for `void foo::f()' does not match any in class `foo'
|
--- Comment #5 from igodard at pacbell dot net 2005-11-22 04:05 ---
On the contrary, const void is a valid type, because the difference between
const void* and void* preserved the typeless constness, which can be
important in disambiguating templates. So if const void is valid as a