dblaikie added a comment.

In D91311#2400926 <https://reviews.llvm.org/D91311#2400926>, @ldionne wrote:

> In D91311#2400917 <https://reviews.llvm.org/D91311#2400917>, @dblaikie wrote:
>
>> How would that work for users - they would get error messages from the 
>> compiler using type names that don't exist in the source code? I'd have 
>> thought that would be quite confusing.
>
> Yes, if a library author decides to say something like:
>
>   template<class _CharT, class _Traits>
>   class [[preferred_name(basic_string_view<char>, "ahaha I'm such a troll")]]
>   basic_string_view {
>       ...
>   };
>
> Then you might get compiler errors that are not super helpful. I don't think 
> the fact that such nonsense is doable means that we shouldn't give this 
> control to library authors.

It's certainly a cost/risk to weigh against the benefits. (both intentional 
weird uses like that, but also accidental misuses like typos).

> For instance, I can easily imagine a library that provides an API where some 
> types shouldn't be named (for example expression templates). In that case, 
> you might want to describe a type by a string along the lines of 
> `decltype(some-expression)`, which could potentially be a lot more useful 
> than the ability to refer to a typedef. Does this sort of usage ring true to 
> someone else?

A concrete/real-world example might be helpful, if you happen to have one on 
hand.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91311/new/

https://reviews.llvm.org/D91311

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

Reply via email to