summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
bba35ac)
PR c++/23896
* pt.c (tsubst_aggr_type): Make sure skip_evaluation is false when
processing template arguments.
PR c++/23896
* g++.dg/template/static17.C: New test.
From-SVN: r104336
2005-09-15 Mark Mitchell <mark@codesourcery.com>
2005-09-15 Mark Mitchell <mark@codesourcery.com>
+ PR c++/23896
+ * pt.c (tsubst_aggr_type): Make sure skip_evaluation is false when
+ processing template arguments.
+
* pt.c (check_explicit_instantiation_namespace): Fix typo.
PR c++/13140
* pt.c (check_explicit_instantiation_namespace): Fix typo.
PR c++/13140
tree argvec;
tree context;
tree r;
tree argvec;
tree context;
tree r;
+ bool saved_skip_evaluation;
+
+ /* In "sizeof(X<I>)" we need to evaluate "I". */
+ saved_skip_evaluation = skip_evaluation;
+ skip_evaluation = false;
/* First, determine the context for the type we are looking
up. */
/* First, determine the context for the type we are looking
up. */
argvec = tsubst_template_args (TYPE_TI_ARGS (t), args,
complain, in_decl);
if (argvec == error_mark_node)
argvec = tsubst_template_args (TYPE_TI_ARGS (t), args,
complain, in_decl);
if (argvec == error_mark_node)
- return error_mark_node;
-
- r = lookup_template_class (t, argvec, in_decl, context,
- entering_scope, complain);
+ r = error_mark_node;
+ else
+ {
+ r = lookup_template_class (t, argvec, in_decl, context,
+ entering_scope, complain);
+ r = cp_build_qualified_type_real (r, TYPE_QUALS (t), complain);
+ }
+
+ skip_evaluation = saved_skip_evaluation;
- return cp_build_qualified_type_real (r, TYPE_QUALS (t), complain);
}
else
/* This is not a template type, so there's nothing to do. */
}
else
/* This is not a template type, so there's nothing to do. */
+2005-09-15 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/23896
+ * g++.dg/template/static17.C: New test.
+
2005-09-15 Joseph S. Myers <joseph@codesourcery.com>
PR c++/23139
2005-09-15 Joseph S. Myers <joseph@codesourcery.com>
PR c++/23139
--- /dev/null
+// PR c++/23896
+
+template <int> struct X {};
+
+template <typename T> struct length {
+ static const int value = 2;
+};
+
+template <typename T> void foo () {
+ sizeof(X<length<T>::value>);
+}
+
+template void foo<int>();