http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60955
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2014-04-26 CC| |manu at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Harald van Dijk from comment #2) > This is caused by the implementation of C++1y decltype(auto), where > seemingly redundant parentheses around an identifier must not simply be > removed, because they may be significant. > > int a; > decltype(auto) b = a; // means int b = a; > decltype(auto) c = (a); // means int &c = a; > > GCC implements this by transforming (a) into static_cast<int &>(a) > (force_paren_expr in gcc/cp/semantics.c), which would normally be a no-op, > but causes the warning when a is declared using the "register" keyword. It is pretty awful that C++14 has made extra parentheses to become significant. But yes, this explains this bug and also PR57573. It would be nice if expressions could be marked as compiler-generated, like we have DECL_ARTIFICIAL for declarations. But you could set TREE_NO_WARNING(expr) = true and check that in the warning code.