https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101783
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jason Merrill <ja...@gcc.gnu.org>: https://gcc.gnu.org/g:7c99923f8c544ec07109e8333acb2c2388c38a1b commit r12-4051-g7c99923f8c544ec07109e8333acb2c2388c38a1b Author: qingzhe huang <nickhuan...@hotmail.com> Date: Fri Oct 1 10:46:35 2021 -0400 c++: cv-qualified ref introduced by typedef [PR101783] The root cause of this bug is that it considers reference with cv-qualifiers as an error by generating value for variable "bad_quals". However, this is not correct for case of typedef. Here I quote spec [dcl.ref]/1 : "Cv-qualified references are ill-formed except when the cv-qualifiers are introduced through the use of a typedef-name ([dcl.typedef], [temp.param]) or decltype-specifier ([dcl.type.decltype]), in which case the cv-qualifiers are ignored." 2021-09-30 qingzhe huang <nickhuan...@hotmail.com> gcc/cp/ChangeLog: PR c++/101783 * tree.c (cp_build_qualified_type_real): Exclude typedef from error. gcc/testsuite/ChangeLog: PR c++/101783 * g++.dg/parse/pr101783.C: New test.