diff options
| author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-07 04:53:59 +0000 |
|---|---|---|
| committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-07 04:53:59 +0000 |
| commit | 714d004c634239d725a57cbbb478590f9ecfad29 (patch) | |
| tree | 37937b4ff2b0e11b4a92113ab4ef5c076b935738 | |
| parent | 7b82ab7f6bfdd7699732f5c1fc0d9873f6f625f7 (diff) | |
| download | ppe42-gcc-714d004c634239d725a57cbbb478590f9ecfad29.tar.gz ppe42-gcc-714d004c634239d725a57cbbb478590f9ecfad29.zip | |
PR c++/55058
* pt.c (tsubst): Keep the quals when looking through a typedef.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194282 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
| -rw-r--r-- | gcc/cp/pt.c | 9 | ||||
| -rw-r--r-- | gcc/testsuite/g++.dg/template/typedef40.C | 21 |
3 files changed, 31 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 22bdb505942..a92ebe147c9 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 2012-12-06 Jason Merrill <jason@redhat.com> + PR c++/55058 + * pt.c (tsubst): Keep the quals when looking through a typedef. + PR c++/55249 * tree.c (build_vec_init_elt): Use the type of the initializer. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 87cd33760c2..33044e0f61c 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -11013,8 +11013,13 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl) return r; } else - /* We don't have an instantiation yet, so drop the typedef. */ - t = DECL_ORIGINAL_TYPE (decl); + { + /* We don't have an instantiation yet, so drop the typedef. */ + int quals = cp_type_quals (t); + t = DECL_ORIGINAL_TYPE (decl); + t = cp_build_qualified_type_real (t, quals, + complain | tf_ignore_bad_quals); + } } if (type diff --git a/gcc/testsuite/g++.dg/template/typedef40.C b/gcc/testsuite/g++.dg/template/typedef40.C new file mode 100644 index 00000000000..1d8be358a20 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/typedef40.C @@ -0,0 +1,21 @@ +// PR c++/55058 + +template <typename T> +struct A { }; + +template <typename T> +struct B { + B(const A<T> T::* p); + typedef A<T> D; +}; + +template <typename T> +B<T>::B(const D T::* p) { } + +struct C { + C() : e() {}; + + const A<C> e; +}; + +B<C> g(&C::e); |

