This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Const in default function arguments?
- From: LLeweLLyn Reese <llewelly at lifesupport dot shutdown dot com>
- To: Eric Lemings <elemings at lemings dot com>
- Cc: eljay at adobe dot com, eric at lemings dot com, gcc-help at gcc dot gnu dot org
- Date: 05 Apr 2003 08:20:52 -0800
- Subject: Re: Const in default function arguments?
- References: <200304041808.h34I8PS8024622@cyberia.lemings.com>
- Reply-to: gcc-help at gcc dot gnu dot org
Eric Lemings <elemings at lemings dot com> writes:
> void foo (int i) {
> ++i;
> }
>
> This function foo doesn't make sense either but it's not a
> compile error. Just because something doesn't make sense
> doesn't mean it's illegal. Sounds like the non-const
> parameter should be a warning, not an error.
No. non-const parameters should cause no warnings, and cause no errors
(as they do now)
Your original post made the error of binding a temporary to a
reference to non-const. That is quite independent of const
parameters or default parameters.
Binding a temporary to a reference to non-const is ill-formed. Some
feel that language rule ought to be changed, but that is a
discussion for another forum (e.g. comp.lang.c++.moderated)
[snip]