This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/56794] New: C++11 Error in range-based for with parameter pack array
- From: "bisqwit at iki dot fi" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 31 Mar 2013 21:07:39 +0000
- Subject: [Bug c++/56794] New: C++11 Error in range-based for with parameter pack array
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56794
Bug #: 56794
Summary: C++11 Error in range-based for with parameter pack
array
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: bisqwit@iki.fi
G++ 4.7.2 and 4.8.0 give the following error message for the for-loop in below
code:
tmp.cc:10:17: error: range-based 'for' expression of type 'const int []' has
incomplete type
On G++ 4.6.3 (and Clang++), it compiles fine. Regression?
template<int... values>
static void Colors()
{
static const int colors[] = { values... };
// ^ This version passes in G++ 4.6 and Clang++ 3.0, fails in G++ 4.7 and
4.8
//static const int colors[sizeof...(values)] = { values... };
// ^This passes in all of them
for(auto c: colors) { }
// ^ This line is the one that gets the error message
}
int main()
{
Colors<0,1,2> ();
}