c++/reflection: reject bare [: bases_of(...)[0] :]

On my P4101 branch splice1.C is crashing in gimplify_expr because we
fail to reject

  [: bases_of (^^T, ctx)[0] :];

which I think should be ill-formed since there's no object.  Splicing a NSDM
also needs an object.

[expr.prim.splice]/2.4 is not explicit about it, but every time the
standard talks about "designates a direct base class relationship" for
a splice, it's phrased in terms of E1.E2, like [expr.ref]/6.  And
P3293 also only mentions obj.[: ... :].

gcc/cp/ChangeLog:

	* reflect.cc (check_splice_expr): Reject splicing a direct base
	class relationship without an object.

gcc/testsuite/ChangeLog:

	* g++.dg/reflect/mangle3.C: Adjust.
	* g++.dg/reflect/splice1.C: Remove XFAIL.

Reviewed-by: Jason Merrill <jason@redhat.com>
3 files changed