This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/37736] New: Problem with designated initializer and template
- From: "simartin at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 5 Oct 2008 06:48:52 -0000
- Subject: [Bug c++/37736] New: Problem with designated initializer and template
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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