https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61292
Jim Rees <jimreesma at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jimreesma at gmail dot com --- Comment #3 from Jim Rees <jimreesma at gmail dot com> --- Reproduced this recently on x86/64-Linux, and did some research: - yes auto seems to strip gcc-style alignment from types. - So does template argument deduction (because the two use the same rules). - Yes, decltype(auto) does not strip the alignment away. - All this appears to be intentional: see gcc source repo, ./gcc/cp/pt.c, line 7926: /* Since type attributes aren't mangled, we need to strip them from template type arguments. */ - The workaround for auto is to avoid using it where your gcc extension attributes matter. Use decltype(auto) if that's useful to you. - The workaround for template argument deduction -- don't pass vector types (with extension attributes) to template parameters. I found that wrapping the vector type in a union or struct works nicely as the mangled name only needs the name of the struct/union so the member type is left intact. If there were to be an actual fix, it might require the mangling format to incorporate gcc extension type attributes, so the stripping of attributes wouldn't be necessary. The template-argument-deduction case is actually something c++ programmers use a lot -- it would be nice if this limitation were better documented. On occasion, one gets the compiler warning about attributes being ignored, but there's no explanation for 1) which attributes, and 2) why that is.