[Bug c++/80990] cv-qualifiers ignored in variable definition using class template argument deduction

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 6 17:41:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80990

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Testing this patch:

--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -25367,7 +25367,7 @@ do_class_deduction (tree ptype, tree tmpl, tree init,
int flags,
   --cp_unevaluated_operand;
   release_tree_vector (args);

-  return TREE_TYPE (t);
+  return cp_build_qualified_type (TREE_TYPE (t), cp_type_quals (ptype));
 }

 /* Replace occurrences of 'auto' in TYPE with the appropriate type deduced


More information about the Gcc-bugs mailing list