]> code.ossystems Code Review - openembedded-core.git/blob
70684de9b9e42a44fd3c0e712d2457b4806bbfe5
[openembedded-core.git] /
1 Upstream-Status: Inappropriate [Backport]
2 From 7ca62e4f7e0e27a4282dc14e5b89c389d5c194bb Mon Sep 17 00:00:00 2001
3 From: jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
4 Date: Tue, 29 Mar 2011 14:26:21 +0000
5 Subject: [PATCH 033/200]        * semantics.c (is_valid_constexpr_fn): Specify input location.
6
7 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@171674 138bc75d-0d04-0410-961f-82ee72b054a4
8
9 index 23bb021..a41a1d5 100644
10 --- a/gcc/cp/semantics.c
11 +++ b/gcc/cp/semantics.c
12 @@ -5390,8 +5390,8 @@ is_valid_constexpr_fn (tree fun, bool complain)
13        {
14         ret = false;
15         if (complain)
16 -         error ("invalid type for parameter %q#D of constexpr function",
17 -                parm);
18 +         error ("invalid type for parameter %d of constexpr "
19 +                "function %q+#D", DECL_PARM_INDEX (parm), fun);
20        }
21  
22    if (!DECL_CONSTRUCTOR_P (fun))
23 @@ -5401,7 +5401,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
24         {
25           ret = false;
26           if (complain)
27 -           error ("invalid return type %qT of constexpr function %qD",
28 +           error ("invalid return type %qT of constexpr function %q+D",
29                    rettype, fun);
30         }
31  
32 @@ -5411,7 +5411,7 @@ is_valid_constexpr_fn (tree fun, bool complain)
33         {
34           ret = false;
35           if (complain)
36 -           error ("enclosing class of %q#D is not a literal type", fun);
37 +           error ("enclosing class of %q+#D is not a literal type", fun);
38         }
39      }
40  
41 index a3706d6..183d3f7 100644
42 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C
43 +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-diag1.C
44 @@ -1,12 +1,11 @@
45  // Test that we explain why a template instantiation isn't constexpr
46  // { dg-options -std=c++0x }
47 -// { dg-prune-output "not a constexpr function" }
48  
49  template <class T>
50  struct A
51  {
52    T t;
53 -  constexpr int f() { return 42; }
54 +  constexpr int f() { return 42; } // { dg-error "enclosing class" }
55  };
56  
57  struct B { B(); operator int(); };
58 @@ -14,8 +13,8 @@ struct B { B(); operator int(); };
59  constexpr A<int> ai = { 42 };
60  constexpr int i = ai.f();
61  
62 -constexpr int b = A<B>().f();  // { dg-error "enclosing class" }
63 +constexpr int b = A<B>().f();  // { dg-error "not a constexpr function" }
64  
65  template <class T>
66 -constexpr int f (T t) { return 42; }
67 -constexpr int x = f(B());      // { dg-error "parameter" }
68 +constexpr int f (T t) { return 42; } // { dg-error "parameter" }
69 +constexpr int x = f(B());           // { dg-error "constexpr function" }
70 -- 
71 1.7.0.4
72