This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the EGCS project.
Re: no match for ..., internal compiler error
- To: lsh@cs.brown.edu
- Subject: Re: no match for ..., internal compiler error
- From: Mark Mitchell <mark@codesourcery.com>
- Date: Fri, 30 Jul 1999 23:17:04 -0700
- Cc: gcc-bugs@gcc.gnu.org
- Organization: CodeSourcery, LLC
- References: <199907290530.BAA26963@poplar.cs.brown.edu>
Loring --
Here's the fix for your problems. Your first test-case was a little
buggy; I fixed it up. If that's not what you intended, and somehow I
missed the real bug, let me know.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
1999-07-30 Mark Mitchell <mark@codesourcery.com>
* call.c (build_conditional_expr): Call convert_from_reference to
avoid reference/non-reference type confusion. Fix typo.
Index: testsuite/g++.old-deja/g++.other/cond3.C
===================================================================
RCS file: cond3.C
diff -N cond3.C
*** /dev/null Sat Dec 5 20:30:03 1998
--- cond3.C Fri Jul 30 23:05:20 1999
***************
*** 0 ****
--- 1,18 ----
+ // Build don't link:
+ // Origin: Loring Holden <lsh@cs.brown.edu>
+
+ class Wtransf {};
+
+ const Wtransf Identity2k;
+
+ class HELPER {
+ public:
+ int current() const { return 0; }
+ };
+
+ void
+ problem_function()
+ {
+ HELPER tm;
+ Wtransf delta = (tm.current()) ? Identity2 : Wtransf();
+ }
Index: testsuite/g++.old-deja/g++.other/cond4.C
===================================================================
RCS file: cond4.C
diff -N cond4.C
*** /dev/null Sat Dec 5 20:30:03 1998
--- cond4.C Fri Jul 30 23:05:20 1999
***************
*** 0 ****
--- 1,31 ----
+ // Build don't link:
+ // Origin: Loring Holden <lsh@cs.brown.edu>
+
+ template <class V>
+ class _vec3d
+ {
+ public:
+ double _x, _y;
+ };
+
+ class Wvec : public _vec3d<int> { };
+
+ template <class T>
+ class TDI {
+ public:
+ T &get();
+ };
+
+ template <class T>
+ class hashvar {
+ public :
+ T _val;
+ TDI<T> *val() const;
+ T get() const { return true ? val()->get() : _val; }
+ };
+
+ int
+ main() {
+ hashvar<Wvec> CONSTRAINT_DIR;
+ CONSTRAINT_DIR.get();
+ }
Index: cp/call.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/call.c,v
retrieving revision 1.154
diff -c -p -r1.154 call.c
*** call.c 1999/07/28 08:20:09 1.154
--- call.c 1999/07/31 06:05:24
*************** conditional_conversion (e1, e2)
*** 2734,2743 ****
}
/* Implement [expr.cond]. ARG1, ARG2, and ARG3 are the three
! arguments to the conditional expression. As an extension, g++
! allows users to overload the ?: operator. By the time this
! function is called, any suitable candidate functions are included
! in CANDIDATES. */
tree
build_conditional_expr (arg1, arg2, arg3)
--- 2734,2742 ----
}
/* Implement [expr.cond]. ARG1, ARG2, and ARG3 are the three
! arguments to the conditional expression. By the time this function
! is called, any suitable candidate functions are included in
! CANDIDATES. */
tree
build_conditional_expr (arg1, arg2, arg3)
*************** build_conditional_expr (arg1, arg2, arg3
*** 2780,2785 ****
--- 2779,2789 ----
_conv_). */
arg1 = cp_convert (boolean_type_node, arg1);
+ /* Convert from reference types to ordinary types; no expressions
+ really have reference type in C++. */
+ arg2 = convert_from_reference (arg2);
+ arg3 = convert_from_reference (arg3);
+
/* [expr.cond]
If either the second or the third operand has type (possibly
*************** build_conditional_expr (arg1, arg2, arg3
*** 2867,2872 ****
--- 2871,2877 ----
else if (conv2 && !ICS_BAD_FLAG (conv2))
{
arg2 = convert_like (conv2, arg2);
+ arg2 = convert_from_reference (arg2);
/* That may not quite have done the trick. If the two types
are cv-qualified variants of one another, we will have
just used an IDENTITY_CONV. (There's no conversion from
*************** build_conditional_expr (arg1, arg2, arg3
*** 2881,2888 ****
else if (conv3 && !ICS_BAD_FLAG (conv3))
{
arg3 = convert_like (conv3, arg3);
if (!same_type_p (TREE_TYPE (arg3), arg2_type))
! arg2 = build1 (NOP_EXPR, arg2_type, arg3);
arg3_type = TREE_TYPE (arg3);
}
}
--- 2886,2894 ----
else if (conv3 && !ICS_BAD_FLAG (conv3))
{
arg3 = convert_like (conv3, arg3);
+ arg3 = convert_from_reference (arg3);
if (!same_type_p (TREE_TYPE (arg3), arg2_type))
! arg3 = build1 (NOP_EXPR, arg2_type, arg3);
arg3_type = TREE_TYPE (arg3);
}
}
*************** build_conditional_expr (arg1, arg2, arg3
*** 2891,2898 ****
If the second and third operands are lvalues and have the same
type, the result is of that type and is an lvalue. */
- arg2_type = non_reference (arg2_type);
- arg3_type = non_reference (arg3_type);
if (real_lvalue_p (arg2) && real_lvalue_p (arg3) &&
same_type_p (arg2_type, arg3_type))
{
--- 2897,2902 ----