sdowney added a comment.

In http://reviews.llvm.org/D18191#376471, @LegalizeAdulthood wrote:

> There is utility in the definition of a function in saying that an argument 
> is `const int i` instead of `int i`.  The const-ness declares the intent that 
> this local variable is not going to be modified.  However, there is that 
> oddity in C++ that allows a declaration to say `void f(int i);` and the 
> implementation to say `void f(const int i) { ... }`.
>
> I think I would like the fixit to preserve the const-ness of the argument 
> while still stripping it of it's reference.


The usual pattern for that is to have the definition use const, and the 
declaration not, since it's an implementation detail if the passed parameter is 
modified. And, unfortunately, I'm stuck with one compiler that mangles those 
two differently, causing link errors.

Having void foo(const int i) in a declaration makes me suspicious, since the 
const is meaningless.

I could make this an option? If the option is set, emit 'const type' if the 
Decl hasBody?


http://reviews.llvm.org/D18191



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to