[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail

2015-03-19 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255

Jason Merrill jason at gcc dot gnu.org changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED
   Target Milestone|4.8.5   |4.9.3

--- Comment #13 from Jason Merrill jason at gcc dot gnu.org ---
Fixed for 4.9.3/5.


[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail

2015-02-25 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255

--- Comment #12 from Jason Merrill jason at gcc dot gnu.org ---
Author: jason
Date: Thu Feb 26 02:43:58 2015
New Revision: 220997

URL: https://gcc.gnu.org/viewcvs?rev=220997root=gccview=rev
Log:
PR c++/62255
* pt.c (instantiate_decl): Handle recursive instantiation of
static data member.

Added:
branches/gcc-4_9-branch/gcc/testsuite/g++.dg/template/recurse4.C
Modified:
branches/gcc-4_9-branch/gcc/cp/ChangeLog
branches/gcc-4_9-branch/gcc/cp/pt.c


[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail

2014-12-19 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

   Target Milestone|4.8.4   |4.8.5

--- Comment #11 from Jakub Jelinek jakub at gcc dot gnu.org ---
GCC 4.8.4 has been released.


[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail

2014-12-10 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

   Keywords||rejects-valid
   Priority|P3  |P2


[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail

2014-09-09 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255

--- Comment #10 from Jason Merrill jason at gcc dot gnu.org ---
Author: jason
Date: Tue Sep  9 11:59:45 2014
New Revision: 215062

URL: https://gcc.gnu.org/viewcvs?rev=215062root=gccview=rev
Log:
PR c++/62255
* pt.c (instantiate_decl): Handle recursive instantiation of
static data member.

Added:
trunk/gcc/testsuite/g++.dg/template/recurse4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/pt.c


[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail

2014-09-06 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255

Jason Merrill jason at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2014-09-06
   Assignee|unassigned at gcc dot gnu.org  |jason at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #9 from Jason Merrill jason at gcc dot gnu.org ---
And one rejected by all of GCC, Clang and EDG (but also accepted by 4.7):

template typename T struct Test {
  templatetypename X static int check(typename X::Type*);
  templatetypename static char check(...);
  static const int value = sizeof(checkT(0));
};
template int struct Sink { };  
template typename T class Derived : SinkTestDerivedT ::value {};
SinkTestDerivedint ::value s;

If we somehow cause Derivedint to be instantiated before the last line, such
as by declaring a Derivedint variable, everything is fine.  We only run into
trouble because it hasn't been.

r197613 caused this to start breaking because before that change we had briefly
been instantiating classes in more situations, but that caused its own
problems.

It's not clear to me that this needs to be ill-formed; the value is not
dependent on itself, it's just an accident of instantiation context.  We could
decide to just handle this.  I think I'll make that change and also bring it up
with the committee.


[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail

2014-09-05 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 CC||jakub at gcc dot gnu.org,
   ||jason at gcc dot gnu.org
   Target Milestone|--- |4.8.4

--- Comment #6 from Jakub Jelinek jakub at gcc dot gnu.org ---
This started to be rejected with r197613 (one needs -std=c++11 -mfxsr to
compile it BTW).  Whether it is valid or not I'll defer to the C++ folks.


[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail

2014-09-05 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255

--- Comment #7 from Jason Merrill jason at gcc dot gnu.org ---
The problem with this testcase is that in evaluating
arma::is_Mat_fixed_onlyarma::eOparma::Coldouble, arma::eop_exp ::value we
need to look up checkarma::eOparma::Coldouble, arma::eop_exp, which means
looking up arma::eOparma::Coldouble, arma::eop_exp::Mat_fixed_type, which
means instantiating arma::eOparma::Coldouble, arma::eop_exp if it isn't
already complete.

Which means instantiating arma::Basedouble, arma::eOparma::Coldouble,
arma::eop_exp

Which means substituting into arma::Base_evalelem_type, derived,
arma::is_Matderived::value

Which depends on arma::is_Mat_fixed_onlyarma::eOparma::Coldouble,
arma::eop_exp ::value, which is where we started.

So instantiating the decl ends up requiring its own definition, though the
actual value does not depend on itself, so we could probably allow it.  The
loop would be avoided if arma::eOparma::Coldouble, arma::eop_exp is
instantiated before we try to instantiate the value.

Here's a simpler testcase that doesn't happen to fail with GCC for some reason,
but does with clang:

template class T struct B;

template bool b
struct C { };

template class T
struct A: CBAT::value
{
  typedef T Type;
};

templateclass T
struct B
{
  templatetypename X static int check(typename X::Type*);
  templatetypename static char check(...);
  static const bool value = (sizeof(checkT(0)) == sizeof(int));
};

int main()
{
  return BAint::value;
}


[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail

2014-09-05 Thread jason at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255

--- Comment #8 from Jason Merrill jason at gcc dot gnu.org ---
And here's a reduced testcase that GCC and EDG reject, but clang accepts.

template typename T struct Test {
  template typename X static void check(typename X::Undefined *);
  template typename static int check(...);
  static const int value = sizeof (checkT());
};
template int struct Sink { };
template typename T struct Base : SinkTestT::value {};
template typename T class Derived : BaseDerivedT  {};

int i[TestDerivedint ::value];