r253266 introduced a bogus "cannot bind bitfield" error that breaks building Chromium and Node.js. Fix by removing the ugly goto.
Tested on ppc64le. Ok for trunk? Thanks. PR c++/82357 * typeck.c (build_static_cast): Handle processing_template_decl without using goto. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 08b2ae555e63..00688a21421c 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -7059,9 +7059,8 @@ build_static_cast (tree type, tree oexpr, tsubst_flags_t complain) bool dependent = (dependent_type_p (type) || type_dependent_expression_p (expr)); - if (dependent) + if (dependent || processing_template_decl) { - tmpl: expr = build_min (STATIC_CAST_EXPR, type, oexpr); /* We don't know if it will or will not have side effects. */ TREE_SIDE_EFFECTS (expr) = 1; @@ -7084,8 +7083,6 @@ build_static_cast (tree type, tree oexpr, tsubst_flags_t complain) maybe_warn_about_useless_cast (type, expr, complain); maybe_warn_about_cast_ignoring_quals (type, complain); } - if (processing_template_decl) - goto tmpl; return result; } diff --git a/gcc/testsuite/g++.dg/template/bitfield4.C b/gcc/testsuite/g++.dg/template/bitfield4.C new file mode 100644 index 000000000000..d53b0d406275 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/bitfield4.C @@ -0,0 +1,6 @@ +// PR c++/82357 + +template <typename> struct A { + A() { x |= 0; } // { dg-bogus "cannot bind bitfield" } + int x : 8; +}; -- Markus