http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55992
Bug #: 55992
Summary: constexpr static member function not recognised in
templated using statement
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: [email protected]
ReportedBy: [email protected]
The compiler fails to resolve a static constexpr member function which is used
in a templated using directive. For example, the following valid code
---------------------------------------------------------------------------------
#include <array>
template<unsigned MaxP, typename Type>
struct test
{
static constexpr unsigned pole(unsigned P)
{ return P>MaxP? MaxP:P; }
template<unsigned P>
using my_array = std::array<Type,pole(P)>; // causing error
template<unsigned P>
void do_something(my_array<P> const&, my_array<P>);
};
---------------------------------------------------------------------------------
produces (when compiling via g++ -c -std=c++11 test.cc using gcc 4.7.1 or
4.7.2)
---------------------------------------------------------------------------------
test.cc:10:42: error: ‘pole’ was not declared in this scope
---------------------------------------------------------------------------------
The compiler can be made happy by explicitly resolving ("test::pole" in line
10) or by not using my_array<> (ie. without the do_something() member)