diff options
author | Jason Merrill <jason@redhat.com> | 2009-11-12 23:21:33 +0000 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2009-11-12 23:21:33 +0000 |
commit | d27f91a96a32c6ba7aa19b7ba2e21afbe1086eea (patch) | |
tree | d8998b920c0b798056bed97bf686d0be44cbb70a | |
parent | 322646de50db3cf01aac96d9a05a3f2044190131 (diff) |
PR c++/39560
* decl2.c (build_anon_union_vars): Set DECL_ARTIFICIAL.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@154133 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/anon7.C | 26 |
4 files changed, 33 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 333c84d88b5..aa2563a5635 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2009-11-12 Jason Merrill <jason@redhat.com> + PR c++/39560 + * decl2.c (build_anon_union_vars): Set DECL_ARTIFICIAL. + PR c++/37037 * decl.c (grokdeclarator): Don't generate a void PARM_DECL. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 510aa8faec1..7c3f7c058d6 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1313,6 +1313,7 @@ build_anon_union_vars (tree type, tree object) decl = build_decl (input_location, VAR_DECL, DECL_NAME (field), TREE_TYPE (field)); DECL_ANON_UNION_VAR_P (decl) = 1; + DECL_ARTIFICIAL (decl) = 1; base = get_base_address (object); TREE_PUBLIC (decl) = TREE_PUBLIC (base); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 49f2e6ab2d1..f616d2ed14c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2009-11-12 Jason Merrill <jason@redhat.com> + PR c++/39560 + * g++.dg/lookup/anon7.C: New. + PR c++/37037 * g++.dg/template/typedef21.C: New. diff --git a/gcc/testsuite/g++.dg/lookup/anon7.C b/gcc/testsuite/g++.dg/lookup/anon7.C new file mode 100644 index 00000000000..79cad0acb99 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/anon7.C @@ -0,0 +1,26 @@ +// PR c++/39560 +// { dg-options -Wunused } + +struct X { }; + +class Z { +public: + X* cc(int c); +}; + +class F { +public: + typedef X* (Z::*MethO)(int); + typedef X* (F::*MethF)(int); + template<MethO m> + X* xwrapper(int i) { + union { + Z *z; + F *f; + }; // { dg-bogus "unused" } + f = this; + return ((z->*m)(i)); + } +}; + +F::MethF meth = &F::xwrapper<&Z::cc>; |