This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/55992] New: constexpr static member function not recognised in templated using statement
- From: "wd11 at leicester dot ac.uk" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Jan 2013 16:01:50 +0000
- Subject: [Bug c++/55992] New: constexpr static member function not recognised in templated using statement
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: wd11@leicester.ac.uk
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)