llvm/llvm-project

Optimize `decltype(T{})` to `T` in compiler error messages

Open

#96,638 建立於 2024年6月25日

在 GitHub 查看
 (11 留言) (1 反應) (0 負責人)C++ (10,782 fork)batch import
clang:diagnosticsgood first issuequality-of-implementation

倉庫指標

Star
 (26,378 star)
PR 合併指標
 (平均合併 1天 2小時) (30 天內合併 1,000 個 PR)

描述

In many cases clang generates an error like:

note: because 'implicitly_convertible(kind_of_<decltype(struct time{{{}}})>{{{}, {}}}, kind_of_<decltype(derived_quantity_spec<power<length, 2>, per<time> >{{{}, {{}}}})>{{{}}})' evaluated to false

besides the #88502 issue the decltype(T{}) also does not help in readability here. The above message could be simplified to:

note: because 'implicitly_convertible(kind_of_<struct time>{}, kind_of_<derived_quantity_spec<power<length, 2>, per<time> >>{})' evaluated to false

Those two issues would help libraries like mp-units provide users with much easier-to-understand diagnostics.

貢獻者指南