https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101477
Bug ID: 101477 Summary: Wrong location for unexpanded parameter pack in function template Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: diagnostic Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- template<typename... Elements> class tuple { }; template<typename... Elements> tuple<Elements> get(const tuple<Elements...>& t) { return t; } The error shows the wrong location: t2.C:7:30: error: parameter packs not expanded with '...': 7 | get(const tuple<Elements...>&) | ^ t2.C:7:30: note: 'Elements' This case is especially confusing because the caret *almost* points to a location where the pack *is* expanded, making it harder to spot the real problem on the line above. It should be: t2.C:7:30: error: parameter packs not expanded with '...': 6 | tuple<Elements> | ^~~~~~~~ t2.C:7:30: note: 'Elements' Even better would be to give a fix-it hint suggesting to add the ... after Element, although that might be counterproductive sometimes. For example, in this case the compiler probably won't guess where to put the ... template<typename... Elements> std::conjunction<is_const<Elements>> get(const tuple<Elements...>& t) { return t; } The user probably wants std::conjunction<is_const<Elements>...> not std::conjunction<is_const<Elements...>>.