This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Const in default function arguments?


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]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]