public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: gcc-patches@gcc.gnu.org, Gabriel Dos Reis <gdr@integrable-solutions.net>
Subject: Re: [C++] Reject variably modified types in operator new
Date: Mon, 25 Jun 2012 14:59:00 -0000	[thread overview]
Message-ID: <4FE87AA6.7020705@redhat.com> (raw)
In-Reply-To: <4FE856D4.90804@redhat.com>

On 06/25/2012 08:17 AM, Florian Weimer wrote:
> The message should point to the typedef, but instead, it references the
> line with operator new (which doesn't even contain the variable n).

Yep, this is another example of how we don't track/use expression 
locations well enough.

> For the non-VLA typedef case, it is an improvement. But I would like to
> leave in both errors, as in the attached patch.

OK.

> If you have suggestions how to improve cxx_constant_value error
> reporting, I can look into that in a separate patch.

One way would be to pass around a location_t loc in the cxx_eval_* 
functions, starting with input_location, but then at the top of 
cxx_eval_constant_expression have

if (EXPR_HAS_LOCATION (t))
   loc = EXPR_LOCATION (t);

and use error_at (loc in all error messages.

And perhaps also change array_type_nelts_top to give the PLUS_EXPR (if 
any) the location of the array typedef (if any).

> Bootstrapped and tested on x86_64-unknown-linux-gnu, with no new
> regressions. OK for trunk?

Yes.

Jason

  reply	other threads:[~2012-06-25 14:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-29 16:01 Florian Weimer
2012-05-29 16:42 ` Gabriel Dos Reis
2012-05-30  8:47   ` Florian Weimer
2012-05-30 16:15     ` Gabriel Dos Reis
2012-05-30 17:49       ` Mike Stump
2012-05-30 18:15 ` Jason Merrill
2012-06-01  9:00 ` Florian Weimer
2012-06-01 12:10   ` Florian Weimer
2012-06-01 15:37     ` Jason Merrill
2012-06-01 15:40       ` Florian Weimer
2012-06-01 16:19         ` Jason Merrill
2012-06-01 19:56           ` Florian Weimer
2012-06-04 16:51             ` Jason Merrill
2012-06-11 16:56     ` Florian Weimer
2012-06-25  5:24       ` Jason Merrill
2012-06-25 13:18         ` Florian Weimer
2012-06-25 14:59           ` Jason Merrill [this message]
2012-06-01 13:03 ` Alexander Monakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FE87AA6.7020705@redhat.com \
    --to=jason@redhat.com \
    --cc=fweimer@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gdr@integrable-solutions.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).