http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20420
Paolo Carlini <paolo.carlini at oracle dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED CC|gcc-bugs at gcc dot gnu.org | AssignedTo|unassigned at gcc dot |paolo.carlini at oracle dot |gnu.org |com Known to fail| | --- Comment #7 from Paolo Carlini <paolo.carlini at oracle dot com> 2012-08-21 19:25:05 UTC --- Currently, the original testcase is *almost* handled correctly - we need something like the below to avoid an ICE with enums - but we still accept the snippet in Comment #4: I just checked and apparently per C++11 too we should reject it. Looking a bit into this, maybe for now I will end up submitting only the patchlet. Index: name-lookup.c =================================================================== --- name-lookup.c (revision 190569) +++ name-lookup.c (working copy) @@ -441,7 +441,8 @@ supplement_binding_1 (cxx_binding *binding, tree d template in order to handle late matching of underlying type on an opaque-enum-declaration followed by an enum-specifier. */ - || (TREE_CODE (TREE_TYPE (target_decl)) == ENUMERAL_TYPE + || (processing_template_decl + && TREE_CODE (TREE_TYPE (target_decl)) == ENUMERAL_TYPE && TREE_CODE (TREE_TYPE (target_bval)) == ENUMERAL_TYPE && (dependent_type_p (ENUM_UNDERLYING_TYPE (TREE_TYPE (target_decl)))