On 05/13/2013 03:20 PM, Jason Merrill wrote:
If we don't like the designator, we should fail pleasantly.
And we ought to accept this case, anyway.
commit 6a9489bb28a4caf64e1b27ce35522990590a74a4 Author: Jason Merrill <ja...@redhat.com> Date: Tue May 14 09:08:15 2013 -0400 PR c++/57041 * pt.c (tsubst_copy_and_build): Don't recur into a designator. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 60b0a8a..ea75b7f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -14359,7 +14359,10 @@ tsubst_copy_and_build (tree t, newlen = vec_safe_length (n); FOR_EACH_VEC_SAFE_ELT (n, idx, ce) { - if (ce->index && process_index_p) + if (ce->index && process_index_p + /* An identifier index is looked up in the type + being initialized, not the current scope. */ + && TREE_CODE (ce->index) != IDENTIFIER_NODE) ce->index = RECUR (ce->index); if (PACK_EXPANSION_P (ce->value)) diff --git a/gcc/testsuite/g++.dg/ext/desig6.C b/gcc/testsuite/g++.dg/ext/desig6.C index 30882a6..ccdafa5 100644 --- a/gcc/testsuite/g++.dg/ext/desig6.C +++ b/gcc/testsuite/g++.dg/ext/desig6.C @@ -1,6 +1,5 @@ // PR c++/57041 // { dg-options "-std=gnu++11" } -// { dg-prune-output "error:" } template<typename T> union u {