re PR c++/48749 (internal compiler error: tree check: expected field_decl)
authorJason Merrill <jason@redhat.com>
Thu, 5 May 2011 02:20:12 +0000 (22:20 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Thu, 5 May 2011 02:20:12 +0000 (22:20 -0400)
PR c++/48749
* class.c (resolves_to_fixed_type_p): Don't look closely
in templates.

From-SVN: r173412

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/conversion/base1.C [new file with mode: 0644]

index dccd765122254fc319e9bb345ad5e784096578fa..ae3ac934fa064d9e33734a6f1546dd1e503c8738 100644 (file)
@@ -1,3 +1,9 @@
+2011-05-04  Jason Merrill  <jason@redhat.com>
+
+       PR c++/48749
+       * class.c (resolves_to_fixed_type_p): Don't look closely
+       in templates.
+
 2011-05-03  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/28501
index 9af238b25e8d8700177e971ff82fea402cf7770d..a67b34a7b60f6a41bf933cafa85aef43ce53b30d 100644 (file)
@@ -5980,7 +5980,17 @@ resolves_to_fixed_type_p (tree instance, int* nonnull)
 {
   tree t = TREE_TYPE (instance);
   int cdtorp = 0;
-  tree fixed = fixed_type_or_null (instance, nonnull, &cdtorp);
+  tree fixed;
+
+  if (processing_template_decl)
+    {
+      /* In a template we only care about the type of the result.  */
+      if (nonnull)
+       *nonnull = true;
+      return true;
+    }
+
+  fixed = fixed_type_or_null (instance, nonnull, &cdtorp);
   if (fixed == NULL_TREE)
     return 0;
   if (POINTER_TYPE_P (t))
index 030501d672ad38db3704b0c00d951b84bebf6eb2..4ff8b0f563f6cb30d95efd910a493c80ad0315c9 100644 (file)
@@ -1,3 +1,7 @@
+2011-05-04  Jason Merrill  <jason@redhat.com>
+
+       * g++.dg/conversion/base1.C: New.
+
 2011-05-04  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR libgfortran/48787
diff --git a/gcc/testsuite/g++.dg/conversion/base1.C b/gcc/testsuite/g++.dg/conversion/base1.C
new file mode 100644 (file)
index 0000000..e236504
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/48749
+
+struct Tuple3
+{
+  float x;
+};
+
+struct Pos: virtual Tuple3 { };
+
+struct TexCoords
+{
+  Pos pos;
+};
+
+template <class T>
+void eval (const TexCoords &coords)
+{
+  const Pos &pos = coords.pos;
+  pos.x;
+}