http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55663
Michael Lopez <mlopez at cse dot tamu.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mlopez at cse dot tamu.edu --- Comment #1 from Michael Lopez <mlopez at cse dot tamu.edu> 2012-12-14 21:35:17 UTC --- I also ran into this bug using GCC 4.8.0 20121121 (experimental) with compile flags -std=c++11 -Wall -pedantic -Wextra Here is a simpler version of the reported bug. template <typename> constexpr bool the_truth () { return true; } template <bool> struct Takes_bool { }; template<bool B> using Alias = Takes_bool<B>; template<typename T> struct test { using type = Alias<the_truth<T>()>; }; int main () { test<int> a; return 0; } The compiler is giving me: main.cpp: In substitution of ‘template<bool B> using Alias = Takes_bool<B> [with bool B = the_truth<int>()]’: main.cpp:11:51: required from ‘struct test<int>’ main.cpp:14:13: required from here main.cpp:11:51: error: integral expression ‘the_truth<int>()’ is not constant struct test { using type = Alias<the_truth<T>()>; }; ^ main.cpp:11:51: error: trying to instantiate ‘template<bool B> using Alias = Takes_bool<B>’ main.cpp: In function ‘int main()’: main.cpp:14:13: warning: unused variable ‘a’ [-Wunused-variable] test<int> a; ^ make: *** [main.o] Error 1 Peeking inside GCC, it seems that the error is thrown from pt.c in check_instantiated_arg. Somehow the template constexpr is loosing its "constantness" when expanded in a dependent context. When the_truth is not a template, there is no error.