[Bug c++/56065] New: Constant expression incorrectly recognized not as such
lucdanton at free dot fr
gcc-bugzilla@gcc.gnu.org
Mon Jan 21 13:12:00 GMT 2013
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56065
Bug #: 56065
Summary: Constant expression incorrectly recognized not as such
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-snapshot --version
gcc-snapshot (Debian 20130113-1) 4.8.0 20130113 (experimental) [trunk revision
195136]
$ cat main.cpp
#include <type_traits>
template<typename T>
constexpr T id(T t) { return t; }
template<int I>
using Alias = std::integral_constant<int, I>;
template<int I>
std::integral_constant<int, id(I)> f()
{ return {}; }
template<int I>
Alias<id(I)> g()
{ return {}; }
int main()
{
// Fine
constexpr auto I = id(5);
(void)I;
// Also fine
f<0>();
// error: integral expression 'id<int>(0)' is not constant
g<0>();
}
More information about the Gcc-bugs
mailing list