From: Jason Merrill Date: Thu, 5 May 2011 02:20:12 +0000 (-0400) Subject: re PR c++/48749 (internal compiler error: tree check: expected field_decl) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4d3baecc5cf1e488369c33bca01effa7762867eb;p=gcc.git re PR c++/48749 (internal compiler error: tree check: expected field_decl) PR c++/48749 * class.c (resolves_to_fixed_type_p): Don't look closely in templates. From-SVN: r173412 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index dccd7651222..ae3ac934fa0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-05-04 Jason Merrill + + PR c++/48749 + * class.c (resolves_to_fixed_type_p): Don't look closely + in templates. + 2011-05-03 Paolo Carlini PR c++/28501 diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 9af238b25e8..a67b34a7b60 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -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)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 030501d672a..4ff8b0f563f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-05-04 Jason Merrill + + * g++.dg/conversion/base1.C: New. + 2011-05-04 Jerry DeLisle 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 index 00000000000..e236504ae87 --- /dev/null +++ b/gcc/testsuite/g++.dg/conversion/base1.C @@ -0,0 +1,20 @@ +// PR c++/48749 + +struct Tuple3 +{ + float x; +}; + +struct Pos: virtual Tuple3 { }; + +struct TexCoords +{ + Pos pos; +}; + +template +void eval (const TexCoords &coords) +{ + const Pos &pos = coords.pos; + pos.x; +}