llvm/llvm-project

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

Open

#96.638 aperta il 25 giu 2024

Vedi su GitHub
 (11 commenti) (1 reazione) (0 assegnatari)C++ (10.782 fork)batch import
clang:diagnosticsgood first issuequality-of-implementation

Metriche repository

Star
 (26.378 star)
Metriche merge PR
 (Merge medio 1g 2h) (1000 PR mergiate in 30 g)

Descrizione

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.

Guida contributor