JonasToth added a comment.

> Also, the template version (whether trailing or normal return) does not 
> trigger the matchers at all, from which I surmise that clang doesn't consider 
> the type const qualified when it is not materialized with an actual type. 
> I've noted as much in the comments, but please correct me if I've 
> misunderstood.
If the template is not instantiated no information on `const` exists and
that might vary between instantiations anyway (if you don't explicitly
write `const T`). It would be an interesting test to try and break the
check with an explicit `const` template and instantiaions with `const`.
(e.g. `template <typename T> const T my_function();` and an
instantiation like `gsl::span<const int>`)

> Finally, as for triggering: I ran this over Google's C++ codebase and found 
> quite a few hits (10k < X < 100k;  not sure I'm allowed to specify a more 
> precise value for X, but if you need it,  let me know and I'll ask).  I 
> sampled 100 of them and confirmed that all were correct.
> 
> I also looked at LLVM and found ~130 hits. I sampled 10 and again found them 
> all correct. I'm happy to post all of the llvm hits if you think that would 
> be helpful.

Did you try the transformation and is it correct (does not break code)?
Enough to check on LLVM :)


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53025



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

Reply via email to