public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/47897] New: [C++0x] static const member variable is not constant expression @ 2011-02-25 21:23 flast at flast dot jp 2011-02-26 0:18 ` [Bug c++/47897] [4.6 Regression][C++0x] " paolo.carlini at oracle dot com ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: flast at flast dot jp @ 2011-02-25 21:23 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47897 Summary: [C++0x] static const member variable is not constant expression Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: major Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: flast@flast.jp GCC4.6.0(with C++0x mode) reject static const member variable depending template parameter type. ---- testcase.C ---- template < typename T, T N > struct S { static const T value = N; typedef S< T, value + 1 > next; }; -------------------- It seems caused by r170488 (git: cfa61f8435164f3205d70c7e1c5038b2d881aa1d). In other case, GCC accepts codes. For example: ---- testcase.C (accepted) ---- template < int N > struct S { static const int value = N; typedef S< value + 1 > next; }; ------------------------------- Another case: ---- testcase.C (accepted) ---- template < typename T, T N > struct S { static constexpr T value = N; typedef S< T, value + 1 > next; }; ------------------------------- ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/47897] [4.6 Regression][C++0x] static const member variable is not constant expression 2011-02-25 21:23 [Bug c++/47897] New: [C++0x] static const member variable is not constant expression flast at flast dot jp @ 2011-02-26 0:18 ` paolo.carlini at oracle dot com 2011-02-26 18:36 ` jason at gcc dot gnu.org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: paolo.carlini at oracle dot com @ 2011-02-26 0:18 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47897 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2011.02.26 00:13:26 CC| |jason at gcc dot gnu.org Target Milestone|--- |4.6.0 Summary|[C++0x] static const member |[4.6 Regression][C++0x] |variable is not constant |static const member |expression |variable is not constant | |expression Ever Confirmed|0 |1 --- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-02-26 00:13:26 UTC --- Urgh, I can confirm this. Jason, can you have a look? ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/47897] [4.6 Regression][C++0x] static const member variable is not constant expression 2011-02-25 21:23 [Bug c++/47897] New: [C++0x] static const member variable is not constant expression flast at flast dot jp 2011-02-26 0:18 ` [Bug c++/47897] [4.6 Regression][C++0x] " paolo.carlini at oracle dot com @ 2011-02-26 18:36 ` jason at gcc dot gnu.org 2011-02-27 8:16 ` jason at gcc dot gnu.org 2011-02-27 16:30 ` jakub at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: jason at gcc dot gnu.org @ 2011-02-26 18:36 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47897 Jason Merrill <jason at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED --- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-02-26 18:24:28 UTC --- Oops. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/47897] [4.6 Regression][C++0x] static const member variable is not constant expression 2011-02-25 21:23 [Bug c++/47897] New: [C++0x] static const member variable is not constant expression flast at flast dot jp 2011-02-26 0:18 ` [Bug c++/47897] [4.6 Regression][C++0x] " paolo.carlini at oracle dot com 2011-02-26 18:36 ` jason at gcc dot gnu.org @ 2011-02-27 8:16 ` jason at gcc dot gnu.org 2011-02-27 16:30 ` jakub at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: jason at gcc dot gnu.org @ 2011-02-27 8:16 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47897 --- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-02-27 08:13:22 UTC --- Author: jason Date: Sun Feb 27 08:13:16 2011 New Revision: 170532 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=170532 Log: PR c++/47897 * semantics.c (non_const_var_error): Split out from... (cxx_eval_constant_expression): ...here. (potential_constant_expression_1) [VAR_DECL]: Use it. Allow dependent variables. Added: trunk/gcc/testsuite/g++.dg/cpp0x/regress/template-const1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/semantics.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/cpp0x/regress/debug-debug7.C trunk/gcc/testsuite/g++.dg/cpp0x/regress/template-function1.C trunk/gcc/testsuite/g++.dg/debug/debug7.C trunk/gcc/testsuite/g++.dg/template/function1.C ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/47897] [4.6 Regression][C++0x] static const member variable is not constant expression 2011-02-25 21:23 [Bug c++/47897] New: [C++0x] static const member variable is not constant expression flast at flast dot jp ` (2 preceding siblings ...) 2011-02-27 8:16 ` jason at gcc dot gnu.org @ 2011-02-27 16:30 ` jakub at gcc dot gnu.org 3 siblings, 0 replies; 5+ messages in thread From: jakub at gcc dot gnu.org @ 2011-02-27 16:30 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47897 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED CC| |jakub at gcc dot gnu.org Resolution| |FIXED --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-02-27 16:01:40 UTC --- Fixed. ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-02-27 16:01 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-02-25 21:23 [Bug c++/47897] New: [C++0x] static const member variable is not constant expression flast at flast dot jp 2011-02-26 0:18 ` [Bug c++/47897] [4.6 Regression][C++0x] " paolo.carlini at oracle dot com 2011-02-26 18:36 ` jason at gcc dot gnu.org 2011-02-27 8:16 ` jason at gcc dot gnu.org 2011-02-27 16:30 ` jakub 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).