public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/54912] New: [C++11] Non-type argument to alias template is not a constant expression @ 2012-10-12 16:11 lucdanton at free dot fr 2012-10-12 16:55 ` [Bug c++/54912] [4.8 Regression] " paolo.carlini at oracle dot com ` (3 more replies) 0 siblings, 4 replies; 5+ messages in thread From: lucdanton at free dot fr @ 2012-10-12 16:11 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54912 Bug #: 54912 Summary: [C++11] Non-type argument to alias template is not a constant expression Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned@gcc.gnu.org ReportedBy: lucdanton@free.fr gcc version 4.8.0 20121008 (experimental) with flags -Wall -pedantic -std=c++11 complains when fed the following program: template<bool B> using Bool = int; template<typename T> void foo() { using bar = Bool<(sizeof(T) >= 0)>; // line 7 } int main() { foo<int>(); } Compiler output: main.cpp: In substitution of 'template<bool B> using Bool = int [with bool B = (sizeof (T) >= 0)]': main.cpp:7:38: required from here main.cpp:7:38: error: integral expression '(sizeof (T) >= 0)' is not constant using bar = Bool<(sizeof(T) >= 0)>; ^ main.cpp:7:38: error: trying to instantiate 'template<bool B> using Bool = int' Using the sizeof expression as the non-type parameter of a class template with the same template parameter list as the alias template is accepted. That same expression can also be used to initialize e.g. a constexpr bool variable, which will in fact in turn be accepted as a parameter to Bool. Previous snapshots of GCC used to accept this kind of code. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54912] [4.8 Regression] Non-type argument to alias template is not a constant expression 2012-10-12 16:11 [Bug c++/54912] New: [C++11] Non-type argument to alias template is not a constant expression lucdanton at free dot fr @ 2012-10-12 16:55 ` paolo.carlini at oracle dot com 2012-10-12 17:08 ` paolo.carlini at oracle dot com ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: paolo.carlini at oracle dot com @ 2012-10-12 16:55 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54912 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2012-10-12 Summary|[C++11] Non-type argument |[4.8 Regression] Non-type |to alias template is not a |argument to alias template |constant expression |is not a constant | |expression Ever Confirmed|0 |1 --- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-12 16:54:53 UTC --- Confirmed as a regression, 4_7-branch is fine. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54912] [4.8 Regression] Non-type argument to alias template is not a constant expression 2012-10-12 16:11 [Bug c++/54912] New: [C++11] Non-type argument to alias template is not a constant expression lucdanton at free dot fr 2012-10-12 16:55 ` [Bug c++/54912] [4.8 Regression] " paolo.carlini at oracle dot com @ 2012-10-12 17:08 ` paolo.carlini at oracle dot com 2012-10-21 22:52 ` paolo.carlini at oracle dot com 2012-10-21 22:53 ` paolo.carlini at oracle dot com 3 siblings, 0 replies; 5+ messages in thread From: paolo.carlini at oracle dot com @ 2012-10-12 17:08 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54912 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-12 17:07:56 UTC --- Most likely a Dup of PR54859, also regressed with 191412. ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54912] [4.8 Regression] Non-type argument to alias template is not a constant expression 2012-10-12 16:11 [Bug c++/54912] New: [C++11] Non-type argument to alias template is not a constant expression lucdanton at free dot fr 2012-10-12 16:55 ` [Bug c++/54912] [4.8 Regression] " paolo.carlini at oracle dot com 2012-10-12 17:08 ` paolo.carlini at oracle dot com @ 2012-10-21 22:52 ` paolo.carlini at oracle dot com 2012-10-21 22:53 ` paolo.carlini at oracle dot com 3 siblings, 0 replies; 5+ messages in thread From: paolo.carlini at oracle dot com @ 2012-10-21 22:52 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54912 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pkeir at outlook dot com --- Comment #3 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-21 22:51:44 UTC --- *** Bug 55013 has been marked as a duplicate of this bug. *** ^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/54912] [4.8 Regression] Non-type argument to alias template is not a constant expression 2012-10-12 16:11 [Bug c++/54912] New: [C++11] Non-type argument to alias template is not a constant expression lucdanton at free dot fr ` (2 preceding siblings ...) 2012-10-21 22:52 ` paolo.carlini at oracle dot com @ 2012-10-21 22:53 ` paolo.carlini at oracle dot com 3 siblings, 0 replies; 5+ messages in thread From: paolo.carlini at oracle dot com @ 2012-10-21 22:53 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54912 Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |DUPLICATE --- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-10-21 22:53:20 UTC --- Dup. *** This bug has been marked as a duplicate of bug 54859 *** ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-10-21 22:53 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-10-12 16:11 [Bug c++/54912] New: [C++11] Non-type argument to alias template is not a constant expression lucdanton at free dot fr 2012-10-12 16:55 ` [Bug c++/54912] [4.8 Regression] " paolo.carlini at oracle dot com 2012-10-12 17:08 ` paolo.carlini at oracle dot com 2012-10-21 22:52 ` paolo.carlini at oracle dot com 2012-10-21 22:53 ` paolo.carlini at oracle dot com
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).