This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Patch for constexpr variable templates

On 2014-07-26 17:14, Jason Merrill wrote:
On 07/26/2014 12:11 PM, Jason Merrill wrote:
On 07/26/2014 03:04 AM, Braden Obrzut wrote:
On 07/25/2014 05:24 PM, Jason Merrill wrote:

Fair enough, but in that case let's use 'sorry' rather then 'error' to
be clear that it's a missing feature.

Tests like g++.dg/cpp1y/pr59638.C produce extra failures if this is
changed. Is there something I'm supposed to do to account for that?

Changing dg-error to dg-message should cover it.

Actually, we shouldn't be treating that testcase as declaring
variable templates at all.  Adam, any thoughts?

In the 59638 case, the declarations

  void (*a)(auto);
  void (*b)(auto) = 0;

are shorthand for

  template <typename T> void (*a)(T);
  template <typename T> void (*b)(T) = 0;

which, unless there's some constraint with variable templates that I'm not aware of, ought to define two variable templates 'a' and 'b' to be ptr-to-function-taking-T. So I think it's correct that the variable template stuff should be triggering here.

Prefixing the two decls with constexpr does allow them to compile (albeit with an "uninitialized const 'a'" permerror in the first case).

The issue with 59638 was that the errors were not correctly unwinding the template scope so declarations further down the file were considered templates when the weren't.

There may be similar recovery issues with not supporting non-constexpr variable templates defined with 'auto' (if that's permitted at all).


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]