W następnym kodemstatycznych funkcji element constexpr w matrycy za pomocą ekspresji nie znaleziono
#include <array>
template<unsigned MaxP, typename type>
struct kernel
{
static constexpr unsigned max_pole(unsigned P)
{ return P>MaxP? MaxP:P; }
template<unsigned P>
using array = std::array<type,max_pole(P)>; // wrong?
template<unsigned P>
static void do_something(array<P> const&, array<P>&);
};
GCC 4.7.0 (g ++ -std -C = C++ 11) daje
error: ‘max_pole’ was not declared in this scope
Jest to poprawne (zachowanie kompilatora)? Zauważ, że jeśli rozwiążę max_pole
przez zastąpienie go kernel::max_pole
we wskazanej linii, kompiluje się dobrze.
EDIT Zgłoszone do bugzilli, zaakceptowane jako błąd C++/55992, patrz http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55992. Występuje również z gcc 4.7.xi 4.8.0.
Po prostu przetestowane: to samo dla 'g ++ 4.7.2' Ktoś ma nowszą wersję jak 4.8? Być może jest to błąd, który został naprawiony ... – leemes