public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Dodji Seketeli <dodji@redhat.com>
To: Jason Merrill <jason@redhat.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] PR c++/55663 - constexpr function templ instantiation considered non-const as alias templ arg
Date: Wed, 09 Jan 2013 15:03:00 -0000	[thread overview]
Message-ID: <87lic2tn4y.fsf@redhat.com> (raw)
In-Reply-To: <50EC7949.2030706@redhat.com> (Jason Merrill's message of "Tue,	08 Jan 2013 14:53:45 -0500")

Jason Merrill <jason@redhat.com> writes:

> On 01/08/2013 08:58 AM, Dodji Seketeli wrote:
>> There, when we check the argument 'the_truth<int>()' to see if it
>> actually is a constant expression, in check_instantiated_arg, we fail
>> to recognize its constexpr-ness b/c we just look at its TREE_CONSTANT.
>
> The problem is that by the time we get to check_instantiated_arg, we
> should have folded the expression into something
> TREE_CONSTANT. convert_template_argument should have done that; don't
> we ever call that function for this template argument?

Presumably, you mean that convert_template_argument should call
convert_nontype_argument to do that folding, right?

I guess the reason why it's not doing it is that the call to
convert_nontype_argument is conditional on

      else if (!uses_template_parms (orig_arg) && !uses_template_parms (t))
	/* We used to call digest_init here.  However, digest_init
	   will report errors, which we don't want when complain
	   is zero.  More importantly, digest_init will try too
	   hard to convert things: for example, `0' should not be
	   converted to pointer type at this point according to
	   the standard.  Accepting this is not merely an
	   extension, since deciding whether or not these
	   conversions can occur is part of determining which
	   function template to call, or whether a given explicit
	   argument specification is valid.  */
	val = convert_nontype_argument (t, orig_arg, complain);

As the argument 'the_truth<T>()' we care about is type dependant,
uses_template_parms returns true and so convert_nontype_argument is
never called.

What is your preferred way want to handle this?

-- 
		Dodji

  reply	other threads:[~2013-01-09 15:03 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-08 13:58 Dodji Seketeli
2013-01-08 16:44 ` Gabriel Dos Reis
2013-01-09 15:31   ` Dodji Seketeli
2013-01-09 16:14     ` Gabriel Dos Reis
2013-01-10 15:22       ` Dodji Seketeli
2013-01-10 16:02         ` Gabriel Dos Reis
2013-01-11 10:41           ` Dodji Seketeli
2013-01-11 10:47             ` Jakub Jelinek
2013-01-11 11:31               ` Dodji Seketeli
2013-01-10 16:11         ` Gabriel Dos Reis
2013-01-10 17:01           ` Jason Merrill
2013-01-11 10:38           ` Dodji Seketeli
2013-01-11 14:53             ` Jason Merrill
2013-01-11 16:33               ` Dodji Seketeli
2013-01-14 14:09                 ` Jason Merrill
2013-01-08 19:53 ` Jason Merrill
2013-01-09 15:03   ` Dodji Seketeli [this message]
2013-01-09 16:17     ` Jason Merrill

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=87lic2tn4y.fsf@redhat.com \
    --to=dodji@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    /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).