https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83997
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jason at gcc dot gnu.org --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- With --- pt.c.jj 2018-01-24 17:18:42.393392254 +0100 +++ pt.c 2018-01-26 14:21:07.285737403 +0100 @@ -13662,18 +13662,45 @@ tsubst (tree t, tree args, tsubst_flags_ case ERROR_MARK: case IDENTIFIER_NODE: case VOID_TYPE: + case LANG_TYPE: + return t; + case REAL_TYPE: case COMPLEX_TYPE: case VECTOR_TYPE: case BOOLEAN_TYPE: case NULLPTR_TYPE: - case LANG_TYPE: + if (TYPE_ATTRIBUTES (t)) + { + tree orig_t = t; + tree attributes = TYPE_ATTRIBUTES (t); + TYPE_ATTRIBUTES (t) = NULL_TREE; + apply_late_template_attributes (&t, attributes, 0, + args, complain, NULL_TREE); + if (t != orig_t) + TYPE_ATTRIBUTES (orig_t) = attributes; + fixup_attribute_variants (t); + } return t; case INTEGER_TYPE: if (t == integer_type_node) return t; + if (TYPE_ATTRIBUTES (t)) + { + tree orig_t = t; + tree attributes = TYPE_ATTRIBUTES (t); + TYPE_ATTRIBUTES (t) = NULL_TREE; + apply_late_template_attributes (&t, attributes, 0, + args, complain, NULL_TREE); + if (t != orig_t) + TYPE_ATTRIBUTES (orig_t) = attributes; + fixup_attribute_variants (t); + if (TREE_CODE (t) != INTEGER_TYPE) + return t; + } + if (TREE_CODE (TYPE_MIN_VALUE (t)) == INTEGER_CST && TREE_CODE (TYPE_MAX_VALUE (t)) == INTEGER_CST) return t; we don't ICE during tsubst anymore and actually get what I expect at least for variable sizes and foo/bar/baz function code on: template<int N> using T = int __attribute__((vector_size (sizeof(int) * N))); template<int N> struct S { typedef int type __attribute__((vector_size (sizeof(int) * N))); }; T<4> q; template<int N> int r __attribute__((vector_size (sizeof(int) * N))); void *s = &r<4>; S<4>::type t; T<4> foo (T<4> a) { return a + 1; } decltype (r<4>) bar (decltype (r<4>) a) { return a + 1; } S<4>::type baz (S<4>::type a) { return a + 1; } but with -flto we still ICE. I'm afraid I must give up.