public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/66260] New: [C++14] Failure to compile variable template with recursively defined partial specialization @ 2015-05-23 5:20 Casey at Carter dot net 2015-08-05 15:40 ` [Bug c++/66260] " jason at gcc dot gnu.org ` (7 more replies) 0 siblings, 8 replies; 9+ messages in thread From: Casey at Carter dot net @ 2015-05-23 5:20 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66260 Bug ID: 66260 Summary: [C++14] Failure to compile variable template with recursively defined partial specialization Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: Casey at Carter dot net Target Milestone: --- Created attachment 35604 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35604&action=edit testcase.cpp Both GCC 5.1.0 and 6.0 fail to compile this program: template <class> constexpr bool foo = false; template <> constexpr bool foo<int> = true; template <class T, int N> constexpr bool foo<T[N]> = foo<T>; static_assert(foo<int>, ""); static_assert(!foo<double>, ""); static_assert(foo<int[3]>, ""); static_assert(!foo<double[3]>, ""); static_assert(foo<int[2][5][3]>, ""); static_assert(!foo<double[2][5][3]>, ""); int main() {} 5.1.0 doesn't seem to recognize that foo is a template-name in the definition of the foo<T[N]> partial specialization: prog.cc:6:33: error: expected primary-expression before '>' token constexpr bool foo<T[N]> = foo<T>; ^ prog.cc:6:34: error: expected primary-expression before ';' token constexpr bool foo<T[N]> = foo<T>; ^ prog.cc:6: confused by earlier errors, bailing out 6.0 20150522 at least tries to compile the recursion, but fails nonetheless: prog.cc: In instantiation of 'constexpr const bool foo': prog.cc:6:16: recursively required from 'constexpr const bool foo' prog.cc:6:16: required from 'constexpr const bool foo' prog.cc:10:15: required from here prog.cc:6:16: fatal error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum) constexpr bool foo<T[N]> = foo<T>; ^ compilation terminated. ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/66260] [C++14] Failure to compile variable template with recursively defined partial specialization 2015-05-23 5:20 [Bug c++/66260] New: [C++14] Failure to compile variable template with recursively defined partial specialization Casey at Carter dot net @ 2015-08-05 15:40 ` jason at gcc dot gnu.org 2015-08-05 17:34 ` jason at gcc dot gnu.org ` (6 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: jason at gcc dot gnu.org @ 2015-08-05 15:40 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66260 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |ASSIGNED Last reconfirmed| |2015-08-05 CC| |jason at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |jason at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> --- Fixed on trunk. ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/66260] [C++14] Failure to compile variable template with recursively defined partial specialization 2015-05-23 5:20 [Bug c++/66260] New: [C++14] Failure to compile variable template with recursively defined partial specialization Casey at Carter dot net 2015-08-05 15:40 ` [Bug c++/66260] " jason at gcc dot gnu.org @ 2015-08-05 17:34 ` jason at gcc dot gnu.org 2015-08-05 17:56 ` jason at gcc dot gnu.org ` (5 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: jason at gcc dot gnu.org @ 2015-08-05 17:34 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66260 --- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Jason Merrill from comment #1) > Fixed on trunk. Oops, haven't checked in the fix yet. ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/66260] [C++14] Failure to compile variable template with recursively defined partial specialization 2015-05-23 5:20 [Bug c++/66260] New: [C++14] Failure to compile variable template with recursively defined partial specialization Casey at Carter dot net 2015-08-05 15:40 ` [Bug c++/66260] " jason at gcc dot gnu.org 2015-08-05 17:34 ` jason at gcc dot gnu.org @ 2015-08-05 17:56 ` jason at gcc dot gnu.org 2015-08-06 4:10 ` jason at gcc dot gnu.org ` (4 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: jason at gcc dot gnu.org @ 2015-08-05 17:56 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66260 --- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Wed Aug 5 17:56:14 2015 New Revision: 226642 URL: https://gcc.gnu.org/viewcvs?rev=226642&root=gcc&view=rev Log: PR c++/66260 PR c++/66596 PR c++/66649 PR c++/66923 * pt.c (lookup_template_variable): Use NULL_TREE for type. (instantiate_template_1): Also set DECL_TI_ARGS based on the immediate parent. (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle variable templates. (finish_template_variable): Add complain parm. * cp-tree.h: Adjust. Added: trunk/gcc/testsuite/g++.dg/cpp1y/var-templ36.C trunk/gcc/testsuite/g++.dg/cpp1y/var-templ38.C trunk/gcc/testsuite/g++.dg/cpp1y/var-templ39.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/cp-tree.h trunk/gcc/cp/pt.c trunk/gcc/testsuite/g++.dg/cpp1y/var-templ32.C trunk/gcc/testsuite/g++.dg/cpp1y/var-templ35.C ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/66260] [C++14] Failure to compile variable template with recursively defined partial specialization 2015-05-23 5:20 [Bug c++/66260] New: [C++14] Failure to compile variable template with recursively defined partial specialization Casey at Carter dot net ` (2 preceding siblings ...) 2015-08-05 17:56 ` jason at gcc dot gnu.org @ 2015-08-06 4:10 ` jason at gcc dot gnu.org 2015-08-06 4:16 ` jason at gcc dot gnu.org ` (3 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: jason at gcc dot gnu.org @ 2015-08-06 4:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66260 --- Comment #4 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Thu Aug 6 04:10:01 2015 New Revision: 226657 URL: https://gcc.gnu.org/viewcvs?rev=226657&root=gcc&view=rev Log: PR c++/66260 PR c++/66596 PR c++/66649 PR c++/66923 * pt.c (lookup_template_variable): Use NULL_TREE for type. (instantiate_template_1): Also set DECL_TI_ARGS based on the immediate parent. (tsubst_copy_and_build) [TEMPLATE_ID_EXPR]: Handle variable templates. (finish_template_variable): Add complain parm. * cp-tree.h: Adjust. Added: branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp1y/var-templ32.C branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp1y/var-templ35.C branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp1y/var-templ36.C branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp1y/var-templ38.C branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp1y/var-templ39.C Modified: branches/gcc-5-branch/gcc/cp/ChangeLog branches/gcc-5-branch/gcc/cp/cp-tree.h branches/gcc-5-branch/gcc/cp/pt.c ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/66260] [C++14] Failure to compile variable template with recursively defined partial specialization 2015-05-23 5:20 [Bug c++/66260] New: [C++14] Failure to compile variable template with recursively defined partial specialization Casey at Carter dot net ` (3 preceding siblings ...) 2015-08-06 4:10 ` jason at gcc dot gnu.org @ 2015-08-06 4:16 ` jason at gcc dot gnu.org 2015-08-06 14:26 ` jason at gcc dot gnu.org ` (2 subsequent siblings) 7 siblings, 0 replies; 9+ messages in thread From: jason at gcc dot gnu.org @ 2015-08-06 4:16 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66260 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution|--- |FIXED Target Milestone|--- |5.3 --- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> --- Fixed for 5.3/6. ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/66260] [C++14] Failure to compile variable template with recursively defined partial specialization 2015-05-23 5:20 [Bug c++/66260] New: [C++14] Failure to compile variable template with recursively defined partial specialization Casey at Carter dot net ` (4 preceding siblings ...) 2015-08-06 4:16 ` jason at gcc dot gnu.org @ 2015-08-06 14:26 ` jason at gcc dot gnu.org 2015-08-06 14:29 ` jason at gcc dot gnu.org 2015-08-06 18:45 ` jason at gcc dot gnu.org 7 siblings, 0 replies; 9+ messages in thread From: jason at gcc dot gnu.org @ 2015-08-06 14:26 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66260 --- Comment #6 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Thu Aug 6 14:26:18 2015 New Revision: 226676 URL: https://gcc.gnu.org/viewcvs?rev=226676&root=gcc&view=rev Log: PR c++/67130 PR c++/67131 PR c++/66260 * mangle.c (write_expression) [TEMPLATE_ID_EXPR]: Handle variable templates. * pt.c (tsubst_copy_and_build): Check for argument substitution failure. Added: trunk/gcc/testsuite/g++.dg/cpp1y/var-templ42.C trunk/gcc/testsuite/g++.dg/cpp1y/var-templ43.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/mangle.c trunk/gcc/cp/pt.c ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/66260] [C++14] Failure to compile variable template with recursively defined partial specialization 2015-05-23 5:20 [Bug c++/66260] New: [C++14] Failure to compile variable template with recursively defined partial specialization Casey at Carter dot net ` (5 preceding siblings ...) 2015-08-06 14:26 ` jason at gcc dot gnu.org @ 2015-08-06 14:29 ` jason at gcc dot gnu.org 2015-08-06 18:45 ` jason at gcc dot gnu.org 7 siblings, 0 replies; 9+ messages in thread From: jason at gcc dot gnu.org @ 2015-08-06 14:29 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66260 --- Comment #7 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Thu Aug 6 14:28:26 2015 New Revision: 226677 URL: https://gcc.gnu.org/viewcvs?rev=226677&root=gcc&view=rev Log: PR c++/67130 PR c++/67131 PR c++/66260 * mangle.c (write_expression) [TEMPLATE_ID_EXPR]: Handle variable templates. * pt.c (tsubst_copy_and_build): Check for argument substitution failure. Added: branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp1y/var-templ42.C branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp1y/var-templ43.C Modified: branches/gcc-5-branch/gcc/cp/ChangeLog branches/gcc-5-branch/gcc/cp/mangle.c branches/gcc-5-branch/gcc/cp/pt.c ^ permalink raw reply [flat|nested] 9+ messages in thread
* [Bug c++/66260] [C++14] Failure to compile variable template with recursively defined partial specialization 2015-05-23 5:20 [Bug c++/66260] New: [C++14] Failure to compile variable template with recursively defined partial specialization Casey at Carter dot net ` (6 preceding siblings ...) 2015-08-06 14:29 ` jason at gcc dot gnu.org @ 2015-08-06 18:45 ` jason at gcc dot gnu.org 7 siblings, 0 replies; 9+ messages in thread From: jason at gcc dot gnu.org @ 2015-08-06 18:45 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66260 --- Comment #8 from Jason Merrill <jason at gcc dot gnu.org> --- Author: jason Date: Thu Aug 6 18:45:05 2015 New Revision: 226696 URL: https://gcc.gnu.org/viewcvs?rev=226696&root=gcc&view=rev Log: PR c++/67130 PR c++/67131 PR c++/66260 * mangle.c (write_expression) [TEMPLATE_ID_EXPR]: Handle variable templates. * pt.c (tsubst_copy_and_build): Check for argument substitution failure. Added: branches/c++-concepts/gcc/testsuite/g++.dg/cpp1y/var-templ42.C branches/c++-concepts/gcc/testsuite/g++.dg/cpp1y/var-templ43.C Modified: branches/c++-concepts/gcc/cp/mangle.c branches/c++-concepts/gcc/cp/pt.c ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2015-08-06 18:45 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-05-23 5:20 [Bug c++/66260] New: [C++14] Failure to compile variable template with recursively defined partial specialization Casey at Carter dot net 2015-08-05 15:40 ` [Bug c++/66260] " jason at gcc dot gnu.org 2015-08-05 17:34 ` jason at gcc dot gnu.org 2015-08-05 17:56 ` jason at gcc dot gnu.org 2015-08-06 4:10 ` jason at gcc dot gnu.org 2015-08-06 4:16 ` jason at gcc dot gnu.org 2015-08-06 14:26 ` jason at gcc dot gnu.org 2015-08-06 14:29 ` jason at gcc dot gnu.org 2015-08-06 18:45 ` jason at gcc dot gnu.org
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).