Const in default function arguments?
LLeweLLyn Reese
llewelly@lifesupport.shutdown.com
Sat Apr 5 16:24:00 GMT 2003
Eric Lemings <elemings@lemings.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]
More information about the Gcc-help
mailing list