PR c++/56243
* call.c (build_over_call): Avoid virtual lookup in a template.
From-SVN: r196343
+2013-02-28 Jason Merrill <jason@redhat.com>
+
+ PR c++/56243
+ * call.c (build_over_call): Avoid virtual lookup in a template.
+
2013-02-27 Jason Merrill <jason@redhat.com>
PR c++/56358
if (!already_used)
mark_used (fn);
- if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0)
+ if (DECL_VINDEX (fn) && (flags & LOOKUP_NONVIRTUAL) == 0
+ /* Don't mess with virtual lookup in fold_non_dependent_expr; virtual
+ functions can't be constexpr. */
+ && !in_template_function ())
{
tree t;
tree binfo = lookup_base (TREE_TYPE (TREE_TYPE (argarray[0])),
--- /dev/null
+// PR c++/56243
+
+struct A
+{
+ virtual int String ();
+};
+
+struct F: A { };
+
+struct G
+{
+ F value;
+};
+
+struct D
+{
+ template <int>
+ void Verify()
+ {
+ G x;
+ F& name = x.value;
+ name.String();
+ }
+};
+
+int main()
+{
+ D d;
+ d.Verify<42>();
+}