[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255 Jason Merrill changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution|--- |FIXED Target Milestone|4.8.5 |4.9.3 --- Comment #13 from Jason Merrill --- Fixed for 4.9.3/5.
[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255 --- Comment #12 from Jason Merrill --- Author: jason Date: Thu Feb 26 02:43:58 2015 New Revision: 220997 URL: https://gcc.gnu.org/viewcvs?rev=220997&root=gcc&view=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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255 Jakub Jelinek changed: What|Removed |Added Target Milestone|4.8.4 |4.8.5 --- Comment #11 from Jakub Jelinek --- GCC 4.8.4 has been released.
[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255 Richard Biener 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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255 --- Comment #10 from Jason Merrill --- Author: jason Date: Tue Sep 9 11:59:45 2014 New Revision: 215062 URL: https://gcc.gnu.org/viewcvs?rev=215062&root=gcc&view=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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255 Jason Merrill 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 --- And one rejected by all of GCC, Clang and EDG (but also accepted by 4.7): template struct Test { template static int check(typename X::Type*); template static char check(...); static const int value = sizeof(check(0)); }; template struct Sink { }; template class Derived : Sink >::value> {}; Sink >::value> s; If we somehow cause Derived to be instantiated before the last line, such as by declaring a Derived 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
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255 --- Comment #8 from Jason Merrill --- And here's a reduced testcase that GCC and EDG reject, but clang accepts. template struct Test { template static void check(typename X::Undefined *); template static int &check(...); static const int value = sizeof (check()); }; template struct Sink { }; template struct Base : Sink::value> {}; template class Derived : Base > {}; int i[Test >::value];
[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255 --- Comment #7 from Jason Merrill --- The problem with this testcase is that in evaluating arma::is_Mat_fixed_only, arma::eop_exp> >::value we need to look up check, arma::eop_exp>>, which means looking up arma::eOp, arma::eop_exp>::Mat_fixed_type, which means instantiating arma::eOp, arma::eop_exp> if it isn't already complete. Which means instantiating arma::Base, arma::eop_exp>> Which means substituting into arma::Base_eval::value> Which depends on arma::is_Mat_fixed_only, 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::eOp, 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 struct B; template struct C { }; template struct A: C>::value> { typedef T Type; }; template struct B { template static int check(typename X::Type*); template static char check(...); static const bool value = (sizeof(check(0)) == sizeof(int)); }; int main() { return B>::value; }
[Bug c++/62255] [4.8/4.9 Regression] Introducing an unrelated template parameter causes compilation to fail
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62255 Jakub Jelinek 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 --- 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.