[Bug c++/70543] [6 Regression] wrong non-const error for enable_if and constexpr function

2016-04-14 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70543

--- Comment #5 from Jason Merrill  ---
Author: jason
Date: Thu Apr 14 20:14:44 2016
New Revision: 234990

URL: https://gcc.gnu.org/viewcvs?rev=234990=gcc=rev
Log:
PR c++/70543

* pt.c (value_dependent_expression_p) [VAR_DECL]: A type-dependent
initializer also makes the variable value-dependent.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-template9.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c

[Bug c++/70543] [6 Regression] wrong non-const error for enable_if and constexpr function

2016-04-14 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70543

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Jason Merrill  ---
Fixed.

[Bug c++/70543] [6 Regression] wrong non-const error for enable_if and constexpr function

2016-04-14 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70543

Jason Merrill  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #5 from Jason Merrill  ---
Author: jason
Date: Thu Apr 14 20:14:44 2016
New Revision: 234990

URL: https://gcc.gnu.org/viewcvs?rev=234990=gcc=rev
Log:
PR c++/70543

* pt.c (value_dependent_expression_p) [VAR_DECL]: A type-dependent
initializer also makes the variable value-dependent.

Added:
trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-template9.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c

--- Comment #6 from Jason Merrill  ---
Fixed.

[Bug c++/70543] [6 Regression] wrong non-const error for enable_if and constexpr function

2016-04-14 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70543

Jason Merrill  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org

[Bug c++/70543] [6 Regression] wrong non-const error for enable_if and constexpr function

2016-04-13 Thread ppalka at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70543

Patrick Palka  changed:

   What|Removed |Added

 CC||ppalka at gcc dot gnu.org

--- Comment #4 from Patrick Palka  ---
Reduced further:

template 
struct X
{
  template 
  static constexpr int
  calc (void)
  {
return 0;
  }

  static constexpr unsigned int value = calc (); // <<<

  char foo[value];
};

[Bug c++/70543] [6 Regression] wrong non-const error for enable_if and constexpr function

2016-04-06 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70543

Jakub Jelinek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2016-04-06
 CC||jakub at gcc dot gnu.org,
   ||jason at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #3 from Jakub Jelinek  ---
The #c0 changed behavior with r226652.
And the #c2 looks like PR70528.

[Bug c++/70543] [6 Regression] wrong non-const error for enable_if and constexpr function

2016-04-05 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70543

Richard Biener  changed:

   What|Removed |Added

   Keywords||rejects-valid
   Target Milestone|--- |6.0

[Bug c++/70543] [6 Regression] wrong non-const error for enable_if and constexpr function

2016-04-05 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70543

--- Comment #2 from Oleg Endo  ---
(In reply to Oleg Endo from comment #1)
> 
> If the marked line is changed to
> 
>   static constexpr unsigned int value = calc<0> ();
> 
> it compiles fine.

However, if doing that "trick" in the bigger production code, there is some new
error:

c++/6.0.0/type_traits:868:48: error: constructor required before non-static
data member for '...' has been parsed
 template
^~~~

[Bug c++/70543] [6 Regression] wrong non-const error for enable_if and constexpr function

2016-04-05 Thread olegendo at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70543

--- Comment #1 from Oleg Endo  ---
A slightly reduced version:

#include 

template  struct X
{
  template  static constexpr
  typename std::enable_if< I == 5, unsigned int>::type
  calc (void)
  {
return 0;
  }

  template  static constexpr
  typename std::enable_if< I != 5, unsigned int>::type
  calc (void)
  {
return 1 + calc ();
  }

  static constexpr unsigned int value = calc (); // <<<

  char foo[value];
};


If the marked line is changed to

  static constexpr unsigned int value = calc<0> ();

it compiles fine.