Commit a160ed77 by Volker Reichelt

parser.c (cp_parser_cast_expression): Use %q#T instead of %qT in old-style cast diagnostic.

        * parser.c (cp_parser_cast_expression): Use %q#T instead of %qT
        in old-style cast diagnostic.
        * typeck.c (maybe_warn_about_useless_cast): Use %q#T instead of %qT
        in useless cast diagnostic.
        * error.c (type_to_string): Remove enum special handling.

        * g++.dg/cpp1z/direct-enum-init1.C: Revert special enum handling.
        * g++.dg/warn/pr12242.C: Likewise.

From-SVN: r250231
parent 76d61a43
......@@ -3172,10 +3172,6 @@ type_to_string (tree typ, int verbose)
if (len == aka_len && memcmp (p, p+aka_start, len) == 0)
p[len] = '\0';
}
if (typ && TYPE_P (typ) && TREE_CODE (typ) == ENUMERAL_TYPE)
pp_string (cxx_pp, M_(" {enum}"));
return pp_ggc_formatted_text (cxx_pp);
}
......
......@@ -8890,7 +8890,7 @@ cp_parser_cast_expression (cp_parser *parser, bool address_p, bool cast_p,
maybe_add_cast_fixit (&rich_loc, open_paren_loc, close_paren_loc,
expr, type);
warning_at_rich_loc (&rich_loc, OPT_Wold_style_cast,
"use of old-style cast to %qT", type);
"use of old-style cast to %q#T", type);
}
/* Only type conversions to integral or enumeration types
......@@ -6681,7 +6681,7 @@ maybe_warn_about_useless_cast (tree type, tree expr, tsubst_flags_t complain)
? xvalue_p (expr) : lvalue_p (expr))
&& same_type_p (TREE_TYPE (expr), TREE_TYPE (type)))
|| same_type_p (TREE_TYPE (expr), type))
warning (OPT_Wuseless_cast, "useless cast to type %qT", type);
warning (OPT_Wuseless_cast, "useless cast to type %q#T", type);
}
}
......
......@@ -10,14 +10,14 @@ void example ()
X x;
Y y;
x = 10; // { dg-warning "invalid conversion from .int. to .X {enum}." "invalid" }
x = 10; // { dg-warning "invalid conversion from .int. to .X." "invalid" }
// { dg-warning "unspecified" "unspecified" { target *-*-* } .-1 }
x = 1; // { dg-warning "invalid conversion from .int. to .X {enum}." }
x = C; // { dg-error "cannot convert .Y {enum}. to .X {enum}. in assignment" }
x = D; // { dg-error "cannot convert .Y {enum}. to .X {enum}. in assignment" }
y = A; // { dg-error "cannot convert .X {enum}. to .Y {enum}. in assignment" }
x = y; // { dg-error "cannot convert .Y {enum}. to .X {enum}. in assignment" }
x = i; // { dg-warning "invalid conversion from .int. to .X {enum}." }
x = 1; // { dg-warning "invalid conversion from .int. to .X." }
x = C; // { dg-error "cannot convert .Y. to .X. in assignment" }
x = D; // { dg-error "cannot convert .Y. to .X. in assignment" }
y = A; // { dg-error "cannot convert .X. to .Y. in assignment" }
x = y; // { dg-error "cannot convert .Y. to .X. in assignment" }
x = i; // { dg-warning "invalid conversion from .int. to .X." }
}
void foo ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment