Looking at this PR again, seems we have reached conclusion that the way forward for GCC 6 is to temporarily disable the check, so I'm posting a patch for that, so as to finally resolve this PR. The problem is that the C++ FE violates the check when it sets FUNCTION_*_QUALIFIED flags.
Bootstrapped/regtested on x86_64-linux, ok for trunk? 2016-04-14 Marek Polacek <pola...@redhat.com> Jan Hubicka <hubi...@ucw.cz> PR c++/70029 * tree.c (verify_type): Disable the canonical type of main variant check. * g++.dg/torture/pr70029.C: New test. diff --git gcc/testsuite/g++.dg/torture/pr70029.C gcc/testsuite/g++.dg/torture/pr70029.C index e69de29..9592f0c 100644 --- gcc/testsuite/g++.dg/torture/pr70029.C +++ gcc/testsuite/g++.dg/torture/pr70029.C @@ -0,0 +1,12 @@ +// PR c++/70029 +// { dg-do compile } +// { dg-options "-std=c++11 -g -flto" } +// { dg-require-effective-target lto } + +struct A +{ + A(); + int foo() && __attribute__ ((__warn_unused_result__)) { return 0; } +}; + +A a; diff --git gcc/tree.c gcc/tree.c index ed28429..c64d720 100644 --- gcc/tree.c +++ gcc/tree.c @@ -13584,7 +13584,9 @@ verify_type (const_tree t) debug_tree (ct); error_found = true; } - if (TYPE_MAIN_VARIANT (t) == t && ct && TYPE_MAIN_VARIANT (ct) != ct) + /* FIXME: this is violated by the C++ FE as discussed in PR70029, when + FUNCTION_*_QUALIFIED flags are set. */ + if (0 && TYPE_MAIN_VARIANT (t) == t && ct && TYPE_MAIN_VARIANT (ct) != ct) { error ("TYPE_CANONICAL of main variant is not main variant"); debug_tree (ct); Marek