]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
cp-tree.h (struct deferred_access_check): Add location.
authorJason Merrill <jason@redhat.com>
Mon, 16 Jul 2012 21:25:30 +0000 (17:25 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 16 Jul 2012 21:25:30 +0000 (17:25 -0400)
* cp-tree.h (struct deferred_access_check): Add location.
* semantics.c (perform_access_checks): Use it.
(perform_or_defer_access_check): Store it.

From-SVN: r189552

gcc/cp/ChangeLog
gcc/cp/cp-tree.h
gcc/cp/semantics.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/parse/access8.C
gcc/testsuite/g++.dg/template/sfinae6_neg.C

index a1326dde5478d18e1209d41cea2c70d6f1844060..a8b19aec857bc097d35b3c5b0278e3366e234459 100644 (file)
@@ -1,3 +1,9 @@
+2012-07-16  Jason Merrill  <jason@redhat.com>
+
+       * cp-tree.h (struct deferred_access_check): Add location.
+       * semantics.c (perform_access_checks): Use it.
+       (perform_or_defer_access_check): Store it.
+
 2012-07-16  Steven Bosscher  <steven@gcc.gnu.org>
 
        * dump.c (dump_stmt): Moved here from c-dump.c.
index 10efa2a663a43797f74569d36628132199ed40f9..59104e7b0943c349851bbdd26e8de71e48de3057 100644 (file)
@@ -5484,6 +5484,8 @@ typedef struct GTY(()) deferred_access_check {
   tree decl;
   /* The declaration that should be used in the error message.  */
   tree diag_decl;
+  /* The location of this access.  */
+  location_t loc;
 } deferred_access_check;
 DEF_VEC_O(deferred_access_check);
 DEF_VEC_ALLOC_O(deferred_access_check,gc);
index a32e48aa0499a590422b8d6315a80b402da87653..81102959f23c663c200e3e460b2b950222bb400f 100644 (file)
@@ -259,12 +259,18 @@ perform_access_checks (VEC (deferred_access_check,gc)* checks)
 {
   int i;
   deferred_access_check *chk;
+  location_t loc = input_location;
 
   if (!checks)
     return;
 
   FOR_EACH_VEC_ELT (deferred_access_check, checks, i, chk)
-    enforce_access (chk->binfo, chk->decl, chk->diag_decl);
+    {
+      input_location = chk->loc;
+      enforce_access (chk->binfo, chk->decl, chk->diag_decl);
+    }
+
+  input_location = loc;
 }
 
 /* Perform the deferred access checks.
@@ -334,6 +340,7 @@ perform_or_defer_access_check (tree binfo, tree decl, tree diag_decl)
   new_access->binfo = binfo;
   new_access->decl = decl;
   new_access->diag_decl = diag_decl;
+  new_access->loc = input_location;
 }
 
 /* Used by build_over_call in LOOKUP_SPECULATIVE mode: return whether DECL
index 1eebfa4d3bbcbbd3bbe5120b4fcf064337b28c3a..f0a13ab3c67372fca43574e44a643f7c53e45fb9 100644 (file)
@@ -1,3 +1,8 @@
+2012-07-16  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/parse/access8.C: Adjust.
+       * g++.dg/template/sfinae6_neg.C: Adjust.
+
 2012-07-16  Thomas König  <tkoenig@gcc.gnu.org>
 
        PR fortran/53824
index 45f4be70288aaaad7a8a472e2adf62083c030f3b..205b7f2712a27a3c0f30b05d37f6ccdf0ca27d2d 100644 (file)
@@ -5,8 +5,8 @@ class foo
   typedef int memfun;  // { dg-error "private" }
 };
 
-template<foo::memfun>
-struct fm_obj { }; // { dg-error "context" } 
+template<foo::memfun> // { dg-error "context" }
+struct fm_obj { };
 
 template <typename T = foo::memfun> // { dg-error "context" }
 struct S {};
index c238222af75c388d4185bb21724c77cb697a9def..28adf73e9f3b5328f1010d5def74f78172d9c15a 100644 (file)
@@ -14,14 +14,14 @@ template<typename T> struct enable_if<false, T> { };
 template<typename F, typename T1, typename T2>
   typename enable_if<sizeof(create_a<F>()(create_a<T1>(), create_a<T2>()), 1),
                     yes_type>::type
-  check_is_callable2(type<F>, type<T1>, type<T2>);
+  check_is_callable2(type<F>, type<T1>, type<T2>); // { dg-error "within this context" }
 
 no_type check_is_callable2(...);
 
 template<typename F, typename T1, typename T2 = T1>
 struct is_callable2
 {
-  static const bool value = // { dg-error "within this context" }
+  static const bool value =
     (sizeof(check_is_callable2(type<F>(), type<T1>(), type<T2>()))
      == sizeof(yes_type));
 };