[Bug c++/37736] New: Problem with designated initializer and template
simartin at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Oct 5 06:50:00 GMT 2008
Opened from comment 4 in PR29727.
The following valid snipped is rejected with the current mainline
===
template<int> struct A
{
struct S { int X; };
static S a;
};
template<int N> typename A<N>::S A<N>::a = { X : 1 };
void foo()
{
A<0>::a;
}
===
because 'X' is not found in the designated initializer:
[...]
pr29727_valid.C:18: error: 'Y' was not declared in this scope
pr29727_valid.C:18: error: 'B<0>::S' has no non-static data member named
'<declaration error>'
We get the same with 4.0.1, 4.2.1 and the 4.3 branch. I don't have any earlier
version to check, so I don't know if this is a regression or not.
With a non template class, the code is accepted.
--
Summary: Problem with designated initializer and template
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: simartin at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37736
More information about the Gcc-bugs
mailing list