Plugin to print a GCC type (e.g. C++-friendly way)

Jonathan Wakely jwakely.gcc@gmail.com
Fri Mar 28 08:29:58 GMT 2025


On Thu, 27 Mar 2025, 18:31 Basile Starynkevitch, <basile@starynkevitch.net>
wrote:

> Hello all,
>
> Is there any GCC-14 or GCC-15 plugin which prints with a pragma the
> (expanded
> C++ type) of something (e.g. C++ template argument or auto variable).
>
> We do have typeof but I miss a #pragma GCC print-type (typeexpression)
>

Given `auto x = 1;` you can do:

template<typename> struct Show;
Show<decltype(x)> show;

You'll get a compile error telling you that Show<int> is incomplete. The
type you want will be part of the error.



>
>


More information about the Gcc-help mailing list