From 915829ccf1a380e5af8d7f59f53a9fe75bc778b1 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 29 Mar 2011 09:27:13 -0400 Subject: [PATCH] * semantics.c (is_valid_constexpr_fn): Specify input location. From-SVN: r171660 --- gcc/cp/ChangeLog | 4 ++++ gcc/cp/semantics.c | 8 ++++---- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C | 9 ++++----- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e19dce9b090..99a06d1fbc5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +2011-03-29 Jason Merrill + + * semantics.c (is_valid_constexpr_fn): Specify input location. + 2011-03-28 Jason Merrill PR c++/48313 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 6906c1be825..da8c0163849 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5338,8 +5338,8 @@ is_valid_constexpr_fn (tree fun, bool complain) { ret = false; if (complain) - error ("invalid type for parameter %q#D of constexpr function", - parm); + error ("invalid type for parameter %d of constexpr " + "function %q+#D", DECL_PARM_INDEX (parm), fun); } if (!DECL_CONSTRUCTOR_P (fun)) @@ -5349,7 +5349,7 @@ is_valid_constexpr_fn (tree fun, bool complain) { ret = false; if (complain) - error ("invalid return type %qT of constexpr function %qD", + error ("invalid return type %qT of constexpr function %q+D", rettype, fun); } @@ -5359,7 +5359,7 @@ is_valid_constexpr_fn (tree fun, bool complain) { ret = false; 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); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6b960a61a46..721427265e5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-03-29 Jason Merrill + + * g++.dg/cpp0x/constexpr-diag1.C: Adjust error locations. + 2011-03-29 Janus Weil PR fortran/48095 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C index a3706d6ec80..183d3f768fa 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C @@ -1,12 +1,11 @@ // Test that we explain why a template instantiation isn't constexpr // { dg-options -std=c++0x } -// { dg-prune-output "not a constexpr function" } template struct A { T t; - constexpr int f() { return 42; } + constexpr int f() { return 42; } // { dg-error "enclosing class" } }; struct B { B(); operator int(); }; @@ -14,8 +13,8 @@ struct B { B(); operator int(); }; constexpr A ai = { 42 }; constexpr int i = ai.f(); -constexpr int b = A().f(); // { dg-error "enclosing class" } +constexpr int b = A().f(); // { dg-error "not a constexpr function" } template -constexpr int f (T t) { return 42; } -constexpr int x = f(B()); // { dg-error "parameter" } +constexpr int f (T t) { return 42; } // { dg-error "parameter" } +constexpr int x = f(B()); // { dg-error "constexpr function" }