Commit f10eaa2d by Jason Merrill Committed by Jason Merrill

class.c (fixed_type_or_null): Handle NSDMI.

	* class.c (fixed_type_or_null): Handle NSDMI.
	* method.c (walk_field_subobs): Disable NSDMI noexcept checking
	for now.

From-SVN: r179435
parent 3bf10857
2011-10-02 Jason Merrill <jason@redhat.com>
* class.c (fixed_type_or_null): Handle NSDMI.
* method.c (walk_field_subobs): Disable NSDMI noexcept checking
for now.
2011-09-30 Jason Merrill <jason@redhat.com> 2011-09-30 Jason Merrill <jason@redhat.com>
* cp-tree.h (TREE_NEGATED_INT): Remove. * cp-tree.h (TREE_NEGATED_INT): Remove.
......
...@@ -6062,10 +6062,13 @@ fixed_type_or_null (tree instance, int *nonnull, int *cdtorp) ...@@ -6062,10 +6062,13 @@ fixed_type_or_null (tree instance, int *nonnull, int *cdtorp)
if (nonnull) if (nonnull)
*nonnull = 1; *nonnull = 1;
/* if we're in a ctor or dtor, we know our type. */ /* if we're in a ctor or dtor, we know our type. If
if (DECL_LANG_SPECIFIC (current_function_decl) current_class_ptr is set but we aren't in a function, we're in
&& (DECL_CONSTRUCTOR_P (current_function_decl) an NSDMI (and therefore a constructor). */
|| DECL_DESTRUCTOR_P (current_function_decl))) if (current_scope () != current_function_decl
|| (DECL_LANG_SPECIFIC (current_function_decl)
&& (DECL_CONSTRUCTOR_P (current_function_decl)
|| DECL_DESTRUCTOR_P (current_function_decl))))
{ {
if (cdtorp) if (cdtorp)
*cdtorp = 1; *cdtorp = 1;
......
...@@ -1042,12 +1042,16 @@ walk_field_subobs (tree fields, tree fnname, special_function_kind sfk, ...@@ -1042,12 +1042,16 @@ walk_field_subobs (tree fields, tree fnname, special_function_kind sfk,
inform (0, "initializer for %q+#D is invalid", field); inform (0, "initializer for %q+#D is invalid", field);
if (trivial_p) if (trivial_p)
*trivial_p = false; *trivial_p = false;
#if 0
/* Core 1351: If the field has an NSDMI that could throw, the /* Core 1351: If the field has an NSDMI that could throw, the
default constructor is noexcept(false). FIXME this is default constructor is noexcept(false). FIXME this is
broken by deferred parsing and 1360 saying we can't broken by deferred parsing and 1360 saying we can't lazily
lazily declare a non-trivial default constructor. */ declare a non-trivial default constructor. Also this
needs to do deferred instantiation. Disable until the
conflict between 1351 and 1360 is resolved. */
if (spec_p && !expr_noexcept_p (DECL_INITIAL (field), complain)) if (spec_p && !expr_noexcept_p (DECL_INITIAL (field), complain))
*spec_p = noexcept_false_spec; *spec_p = noexcept_false_spec;
#endif
/* Don't do the normal processing. */ /* Don't do the normal processing. */
continue; continue;
......
2011-10-02 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/nsdmi5.C: New.
2011-10-02 Richard Sandiford <rdsandiford@googlemail.com> 2011-10-02 Richard Sandiford <rdsandiford@googlemail.com>
PR target/50579 PR target/50579
......
// { dg-options -std=c++0x }
struct X
{
int x = 5;
int f() { return x; }
};
struct Y : X
{
int y = this->x;
};
template <class T> struct Z : T
{
int y = this->f();
};
int main()
{
Y foo;
Z<X> bar;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment