Hello, in this PR, we end up with 3 types A, B and C such that TYPE_CANONICAL(A)=B and TYPE_CANONICAL(B)=C. I don't think that is supposed to happen. Here, build_qualified_type fills in TYPE_CANONICAL(A) by calling build_qualified_type (so get_qualified_type), which afaics isn't guaranteed to return a canonical type. I doubt the patch can be wrong, but it may be that this is a situation that is not supposed to happen and should be fixed elsewhere? Bootstrap+testsuite on x86_64-linux-gnu. 2014-06-09 Marc Glisse PR c++/54442 gcc/ * tree.c (build_qualified_type): Use a canonical type for TYPE_CANONICAL. gcc/testsuite/ * g++.dg/pr54442.C: New file. -- Marc Glisse