Commit 8211c4a2 by Volker Reichelt Committed by Volker Reichelt

parser.c (cp_parser_cast_expression): Add target type of cast to diagnostic.

        * parser.c (cp_parser_cast_expression): Add target type of cast to
        diagnostic.
        * error.c (type_to_string): Add '{enum}' suffix to enumeration types.

        * g++.dg/cpp1z/direct-enum-init1.C: Adjust for more verbose enum
        diagnostics.
        * g++.dg/warn/pr12242.C: Likewise.

From-SVN: r247347
parent 4ca4927a
2017-04-27 Volker Reichelt <v.reichelt@netcologne.de>
* parser.c (cp_parser_cast_expression): Add target type of cast to
diagnostic.
* error.c (type_to_string): Add '{enum}' suffix to enumeration types.
2017-04-26 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (grok_ctor_properties, ambi_op_p, unary_op_p): Change
......
......@@ -3134,6 +3134,10 @@ 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);
}
......
......@@ -8763,7 +8763,8 @@ cp_parser_cast_expression (cp_parser *parser, bool address_p, bool cast_p,
&& !in_system_header_at (input_location)
&& !VOID_TYPE_P (type)
&& current_lang_name != lang_name_c)
warning (OPT_Wold_style_cast, "use of old-style cast");
warning (OPT_Wold_style_cast,
"use of old-style cast to %qT", type);
/* Only type conversions to integral or enumeration types
can be used in constant-expressions. */
2017-04-27 Volker Reichelt <v.reichelt@netcologne.de>
* g++.dg/cpp1z/direct-enum-init1.C: Adjust for more verbose enum
diagnostics.
* g++.dg/warn/pr12242.C: Likewise.
2017-04-27 David Edelsohn <dje.gcc@gmail.com>
* gcc.c-torture/execute/alias-3.c: Skip on AIX.
......
......@@ -10,14 +10,14 @@ void example ()
X x;
Y y;
x = 10; // { dg-warning "invalid conversion from .int. to .X." "invalid" }
x = 10; // { dg-warning "invalid conversion from .int. to .X {enum}." "invalid" }
// { dg-warning "unspecified" "unspecified" { target *-*-* } .-1 }
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." }
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}." }
}
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