From 05b03452db6a520091aed254d3c399caed714b15 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Fri, 6 Nov 2020 20:41:54 -0500 Subject: c++: Improve error location for class using-decl. We should use the location of the using-declaration, not the location of the class. gcc/cp/ChangeLog: * class.c (handle_using_decl): Add an iloc_sentinel. gcc/testsuite/ChangeLog: * g++.dg/lookup/using26.C: Adjust location. * g++.old-deja/g++.other/using1.C: Adjust location. --- gcc/cp/class.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/cp/class.c') diff --git a/gcc/cp/class.c b/gcc/cp/class.c index c037372..7c34d94 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -1,4 +1,4 @@ -/* Functions related to building classes and their related objects. +/* Functions related to building -*- C++ -*- classes and their related objects. Copyright (C) 1987-2020 Free Software Foundation, Inc. Contributed by Michael Tiemann (tiemann@cygnus.com) @@ -1322,6 +1322,8 @@ handle_using_decl (tree using_decl, tree t) return; } + iloc_sentinel ils (DECL_SOURCE_LOCATION (using_decl)); + /* Make type T see field decl FDECL with access ACCESS. */ if (flist) for (ovl_iterator iter (flist); iter; ++iter) -- cgit v1.1