]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/10468 (const typeof(x) is non-const, but only in templates)
authorMark Mitchell <mark@codesourcery.com>
Fri, 27 Jun 2003 22:46:47 +0000 (22:46 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 27 Jun 2003 22:46:47 +0000 (22:46 +0000)
PR c++/10468
* pt.c (tsubst): Handle qualified TYPEOF_TYPEs correctly.

PR c++/10468
* g++.dg/ext/typeof5.C: New test.

From-SVN: r68615

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/ext/typeof6.C [new file with mode: 0644]

index 3e1fa5d4ab09c9baf517903836d688324b6f7c35..69242ca97ee007ecfc98ed1fd4d8fda6ffd5e2de 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-27  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/10468
+       * pt.c (tsubst): Handle qualified TYPEOF_TYPEs correctly.
+
 2003-06-27  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/10796
index 282c788180fb507a1f107f735c87e5780c052494..75b3537e53a9b14968c20a9787a92d991d8250bb 100644 (file)
@@ -7062,7 +7062,10 @@ tsubst (tree t, tree args, tsubst_flags_t complain, tree in_decl)
        if (e1 == error_mark_node)
          return error_mark_node;
 
-       return TREE_TYPE (e1); 
+       return cp_build_qualified_type_real (TREE_TYPE (e1),
+                                            cp_type_quals (t)
+                                            | cp_type_quals (TREE_TYPE (e1)),
+                                            complain);
       }
 
     default:
index b407402ed3f97e12f354ca2a3a94e72b010c4cbb..e551aae327aa096ef6c1b875884dbad19bd21735 100644 (file)
@@ -1,3 +1,8 @@
+2003-06-27  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/10468
+       * g++.dg/ext/typeof6.C: New test.
+
 2003-06-27  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/10796
diff --git a/gcc/testsuite/g++.dg/ext/typeof6.C b/gcc/testsuite/g++.dg/ext/typeof6.C
new file mode 100644 (file)
index 0000000..ef75f25
--- /dev/null
@@ -0,0 +1,17 @@
+// { dg-options "" }
+
+template <class T>
+void test1() {
+  int x = 0;
+  const typeof(x) & t1 = x+0;
+}
+
+void test2() {
+  int x = 0;
+  const typeof(x) & t1 = x+0;
+}
+
+int main() {
+  test1<int>();
+  test2 ();
+}