* semantics.c (is_valid_constexpr_fn): Specify input location.

From-SVN: r171660
This commit is contained in:
Jason Merrill 2011-03-29 09:27:13 -04:00 committed by Jason Merrill
parent 86c8d1f646
commit 915829ccf1
4 changed files with 16 additions and 9 deletions

View File

@ -1,3 +1,7 @@
2011-03-29 Jason Merrill <jason@redhat.com>
* semantics.c (is_valid_constexpr_fn): Specify input location.
2011-03-28 Jason Merrill <jason@redhat.com> 2011-03-28 Jason Merrill <jason@redhat.com>
PR c++/48313 PR c++/48313

View File

@ -5338,8 +5338,8 @@ is_valid_constexpr_fn (tree fun, bool complain)
{ {
ret = false; ret = false;
if (complain) if (complain)
error ("invalid type for parameter %q#D of constexpr function", error ("invalid type for parameter %d of constexpr "
parm); "function %q+#D", DECL_PARM_INDEX (parm), fun);
} }
if (!DECL_CONSTRUCTOR_P (fun)) if (!DECL_CONSTRUCTOR_P (fun))
@ -5349,7 +5349,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
{ {
ret = false; ret = false;
if (complain) if (complain)
error ("invalid return type %qT of constexpr function %qD", error ("invalid return type %qT of constexpr function %q+D",
rettype, fun); rettype, fun);
} }
@ -5359,7 +5359,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
{ {
ret = false; ret = false;
if (complain) if (complain)
error ("enclosing class of %q#D is not a literal type", fun); error ("enclosing class of %q+#D is not a literal type", fun);
} }
} }

View File

@ -1,3 +1,7 @@
2011-03-29 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/constexpr-diag1.C: Adjust error locations.
2011-03-29 Janus Weil <janus@gcc.gnu.org> 2011-03-29 Janus Weil <janus@gcc.gnu.org>
PR fortran/48095 PR fortran/48095

View File

@ -1,12 +1,11 @@
// Test that we explain why a template instantiation isn't constexpr // Test that we explain why a template instantiation isn't constexpr
// { dg-options -std=c++0x } // { dg-options -std=c++0x }
// { dg-prune-output "not a constexpr function" }
template <class T> template <class T>
struct A struct A
{ {
T t; T t;
constexpr int f() { return 42; } constexpr int f() { return 42; } // { dg-error "enclosing class" }
}; };
struct B { B(); operator int(); }; struct B { B(); operator int(); };
@ -14,8 +13,8 @@ struct B { B(); operator int(); };
constexpr A<int> ai = { 42 }; constexpr A<int> ai = { 42 };
constexpr int i = ai.f(); constexpr int i = ai.f();
constexpr int b = A<B>().f(); // { dg-error "enclosing class" } constexpr int b = A<B>().f(); // { dg-error "not a constexpr function" }
template <class T> template <class T>
constexpr int f (T t) { return 42; } constexpr int f (T t) { return 42; } // { dg-error "parameter" }
constexpr int x = f(B()); // { dg-error "parameter" } constexpr int x = f(B()); // { dg-error "constexpr function" }