2017-11-21 Martin Liska <mliska@suse.cz> * class.c (finalize_literal_type_property): Add quotes for constexpr keyword. (explain_non_literal_class): Likewise. * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise. (is_valid_constexpr_fn): Likewise. (check_constexpr_ctor_body): Likewise. (register_constexpr_fundef): Likewise. (explain_invalid_constexpr_fn): Likewise. (cxx_eval_builtin_function_call): Likewise. (cxx_eval_call_expression): Likewise. (cxx_eval_loop_expr): Likewise. (potential_constant_expression_1): Likewise. * decl.c (check_previous_goto_1): Likewise. (check_goto): Likewise. (grokfndecl): Likewise. (grokdeclarator): Likewise. * error.c (maybe_print_constexpr_context): Likewise. * method.c (process_subob_fn): Likewise. (defaulted_late_check): Likewise. * parser.c (cp_parser_compound_statement): Likewise. 2017-11-21 Martin Liska <mliska@suse.cz> * g++.dg/cpp0x/constexpr-48089.C: Add quotes for constexpr keyword; add dg-message for 'in .constexpr. expansion of '. * g++.dg/cpp0x/constexpr-50060.C: Likewise. * g++.dg/cpp0x/constexpr-60049.C: Likewise. * g++.dg/cpp0x/constexpr-70323.C: Likewise. * g++.dg/cpp0x/constexpr-70323a.C: Likewise. * g++.dg/cpp0x/constexpr-cast.C: Likewise. * g++.dg/cpp0x/constexpr-diag3.C: Likewise. * g++.dg/cpp0x/constexpr-ex1.C: Likewise. * g++.dg/cpp0x/constexpr-generated1.C: Likewise. * g++.dg/cpp0x/constexpr-ice16.C: Likewise. * g++.dg/cpp0x/constexpr-ice5.C: Likewise. * g++.dg/cpp0x/constexpr-incomplete2.C: Likewise. * g++.dg/cpp0x/constexpr-neg1.C: Likewise. * g++.dg/cpp0x/constexpr-recursion.C: Likewise. * g++.dg/cpp0x/constexpr-shift1.C: Likewise. * g++.dg/cpp1y/constexpr-70265-1.C: Likewise. * g++.dg/cpp1y/constexpr-70265-2.C: Likewise. * g++.dg/cpp1y/constexpr-79655.C: Likewise. * g++.dg/cpp1y/constexpr-new.C: Likewise. * g++.dg/cpp1y/constexpr-return2.C: Likewise. * g++.dg/cpp1y/constexpr-shift1.C: Likewise. * g++.dg/cpp1y/constexpr-throw.C: Likewise. * g++.dg/cpp1z/constexpr-lambda6.C: Likewise. * g++.dg/ext/constexpr-vla1.C: Likewise. * g++.dg/ext/constexpr-vla2.C: Likewise. * g++.dg/ext/constexpr-vla3.C: Likewise. * g++.dg/cpp0x/static_assert10.C: Likewise. * g++.dg/cpp1y/pr63996.C: Likewise. * g++.dg/cpp1y/pr68180.C: Likewise. * g++.dg/cpp1y/pr77830.C: Likewise. * g++.dg/ubsan/pr63956.C: Likewise. From-SVN: r255025
51 lines
1.2 KiB
C
51 lines
1.2 KiB
C
// PR c++/48089
|
|
// { dg-do compile { target c++11 } }
|
|
|
|
// bang is ill-formed (diagnostic required) because its initializer is
|
|
// non-constant, because it uses the value of an uninitialized object.
|
|
|
|
// s() is ill-formed (no diagnostic required) because there is no set of
|
|
// arguments that would produce a constant expression.
|
|
|
|
// R() is well-formed because i is initialized before j.
|
|
|
|
struct s {
|
|
constexpr s() : v(v) { }
|
|
int v;
|
|
};
|
|
|
|
constexpr s bang; // { dg-error "|" }
|
|
|
|
struct R {
|
|
int i,j;
|
|
constexpr R() : i(42),j(i) { } // { dg-bogus "" }
|
|
};
|
|
|
|
constexpr R r; // { dg-bogus "" }
|
|
|
|
// Ill-formed (no diagnostic required)
|
|
struct T {
|
|
int i;
|
|
constexpr int f() { return i; }
|
|
constexpr T(): i(0) { }
|
|
constexpr T(const T& t) : i(f()) { } // { dg-message "" }
|
|
};
|
|
|
|
constexpr T t1;
|
|
// Ill-formed (diagnostic required)
|
|
constexpr T t2(t1); // { dg-message "" }
|
|
|
|
// Well-formed
|
|
struct U {
|
|
int i, j;
|
|
constexpr int f(int _i) { return _i; }
|
|
constexpr int g() { return i; }
|
|
constexpr U(): i(0), j(0) { }
|
|
constexpr U(const U& t) : i(f(t.i)),j(0) { } // { dg-bogus "" }
|
|
constexpr U(int _i) : i(_i),j(g()) { } // { dg-bogus "" }
|
|
};
|
|
|
|
constexpr U u1;
|
|
constexpr U u2(u1); // { dg-bogus "" }
|
|
constexpr U u3(1); // { dg-bogus "" }
|