aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-03-29 09:27:13 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-03-29 09:27:13 -0400
commit915829ccf1a380e5af8d7f59f53a9fe75bc778b1 (patch)
treec3dc925150587ace20ca54156c8c2548ddafe590
parent86c8d1f646594d65f8d78714e59c948aefe918ef (diff)
downloadgcc-915829ccf1a380e5af8d7f59f53a9fe75bc778b1.zip
gcc-915829ccf1a380e5af8d7f59f53a9fe75bc778b1.tar.gz
gcc-915829ccf1a380e5af8d7f59f53a9fe75bc778b1.tar.bz2
* semantics.c (is_valid_constexpr_fn): Specify input location.
From-SVN: r171660
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/semantics.c8
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C9
4 files changed, 16 insertions, 9 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index e19dce9..99a06d1 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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>
PR c++/48313
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index 6906c1b..da8c016 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 6b960a6..7214272 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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>
PR fortran/48095
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C
index a3706d6..183d3f7 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 <class T>
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<int> ai = { 42 };
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>
-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" }