On Thu, Dec 05, 2019 at 06:21:14PM +0000, Richard Sandiford wrote:
> Ping.
> 
> Richard Sandiford <richard.sandif...@arm.com> writes:
> > This patch makes the C++ frontend work with the verify_type_context hook
> > [https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00942.html].  We need
> > some new type contexts for features that don't exist in C, but otherwise
> > the patch is very similar to the C one.
> >
> > TCTX_CAPTURE_BY_COPY could really be treated as an instance of
> > TCTX_FIELD, but the error message is better if we split it out.
> >
> > Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?
...
> Index: gcc/cp/decl.c
> ===================================================================
> --- gcc/cp/decl.c     2019-12-04 10:58:40.000000000 +0000
> +++ gcc/cp/decl.c     2019-12-04 10:59:10.215988487 +0000
> @@ -5470,6 +5470,13 @@ start_decl_1 (tree decl, bool initialize
>        cp_apply_type_quals_to_decl (cp_type_quals (type), decl);
>      }
>  
> +  if (is_global_var (decl))
> +    {
> +      type_context_kind context = (DECL_THREAD_LOCAL_P (decl)
> +                                ? TCTX_THREAD_STORAGE
> +                                : TCTX_STATIC_STORAGE);
> +      verify_type_context (input_location, context, TREE_TYPE (decl));
> +    }
>    if (initialized)
>      /* Is it valid for this decl to have an initializer at all?  */
>      {
> @@ -6527,6 +6534,12 @@ check_array_initializer (tree decl, tree
>       error ("elements of array %q#T have incomplete type", type);
>        return true;
>      }
> +
> +  location_t loc = (decl && DECL_P (decl)
> +                 ? DECL_SOURCE_LOCATION (decl) : input_location);

Not a review but I suspect you could use location_of here.

--
Marek Polacek • Red Hat, Inc. • 300 A St, Boston, MA

Reply via email to