diff options
author | Nathan Sidwell <nathan@codesourcery.com> | 2001-03-02 11:44:57 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2001-03-02 11:44:57 +0000 |
commit | d282fcb29aee561a8d60646d45333e5e89b4c5d4 (patch) | |
tree | ca8ae4a6f674f5a891c395ce0d56909407009a97 /gcc | |
parent | f86fdf68cfe35212160b8d337c7db7110ad0da8d (diff) | |
download | gcc-d282fcb29aee561a8d60646d45333e5e89b4c5d4.zip gcc-d282fcb29aee561a8d60646d45333e5e89b4c5d4.tar.gz gcc-d282fcb29aee561a8d60646d45333e5e89b4c5d4.tar.bz2 |
class.c (check_field_decls): Pointers to member do not a non-pod struct make, as per DR 148.
cp:
* class.c (check_field_decls): Pointers to member do not a
non-pod struct make, as per DR 148.
testsuite:
* g++.old-deja/g++.other/pod1.C: New test.
From-SVN: r40186
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/class.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/testsuite/g++.old-deja/g++.other/pod1.C | 21 |
4 files changed, 33 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 78899b6..af98592 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,10 @@ 2001-03-02 Nathan Sidwell <nathan@codesourcery.com> + * class.c (check_field_decls): Pointers to member do not a + non-pod struct make, as per DR 148. + +2001-03-02 Nathan Sidwell <nathan@codesourcery.com> + * call.c (joust): cp_pedwarn when using gnu extension concerning worst conversion sequences. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 8af19c5..2fb75b2 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -3594,10 +3594,9 @@ check_field_decls (t, access_decls, empty_p, if (DECL_MUTABLE_P (x) || TYPE_HAS_MUTABLE_P (type)) CLASSTYPE_HAS_MUTABLE (t) = 1; - if (! pod_type_p (type) - /* For some reason, pointers to members are POD types themselves, - but are not allowed in POD structs. Silly. */ - || TYPE_PTRMEM_P (type) || TYPE_PTRMEMFUNC_P (type)) + if (! pod_type_p (type)) + /* DR 148 now allows pointers to members (which are POD themselves), + to be allowed in POD structs. */ CLASSTYPE_NON_POD_P (t) = 1; /* If any field is const, the structure type is pseudo-const. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6c43b68..e0b9178 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,9 @@ 2001-03-02 Nathan Sidwell <nathan@codesourcery.com> + * g++.old-deja/g++.other/pod1.C: New test. + +2001-03-02 Nathan Sidwell <nathan@codesourcery.com> + * g++.old-deja/g++.ext/overload1.C: New test. 2001-03-01 Nathan Sidwell <nathan@codesourcery.com> diff --git a/gcc/testsuite/g++.old-deja/g++.other/pod1.C b/gcc/testsuite/g++.old-deja/g++.other/pod1.C new file mode 100644 index 0000000..c6faf0d --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/pod1.C @@ -0,0 +1,21 @@ +// Build don't link: + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 28 Feb 2001 <nathan@codesourcery.com> + +// DR 148. Now allows pointer to members in POD struct. + +struct X +{ + int X::*m; + int (X::*f) (); +}; + +void Foo (int, ...); + +void Baz () +{ + X x; + + Foo (1, x); +} |