re PR c++/17821 (Poor diagnostic for using . instead of ->)
cp: PR c++/17821 * class.c (add_method): Do not push conversion operators into a binding level. * cp-tree.h (CLASSTYPE_PRIMARY_TEMPLATE_TYPE): Reformat. * error.c (dump_decl): <TYPE_DECL case> Remove extraneous braces. testsuite: PR c++/17821 * g++.dg/lookup/conv-5.C: New. From-SVN: r92316
This commit is contained in:
parent
64d200483a
commit
b54a07e8d2
|
@ -1,3 +1,12 @@
|
||||||
|
2004-12-17 Nathan Sidwell <nathan@codesourcery.com>
|
||||||
|
|
||||||
|
PR c++/17821
|
||||||
|
* class.c (add_method): Do not push conversion operators into a
|
||||||
|
binding level.
|
||||||
|
|
||||||
|
* cp-tree.h (CLASSTYPE_PRIMARY_TEMPLATE_TYPE): Reformat.
|
||||||
|
* error.c (dump_decl): <TYPE_DECL case> Remove extraneous braces.
|
||||||
|
|
||||||
2004-12-16 Nathan Sidwell <nathan@codesourcery.com>
|
2004-12-16 Nathan Sidwell <nathan@codesourcery.com>
|
||||||
|
|
||||||
PR c++/18905
|
PR c++/18905
|
||||||
|
|
|
@ -857,7 +857,8 @@ add_method (tree type, tree method)
|
||||||
int using;
|
int using;
|
||||||
unsigned slot;
|
unsigned slot;
|
||||||
tree overload;
|
tree overload;
|
||||||
int template_conv_p;
|
bool template_conv_p = false;
|
||||||
|
bool conv_p;
|
||||||
VEC(tree) *method_vec;
|
VEC(tree) *method_vec;
|
||||||
bool complete_p;
|
bool complete_p;
|
||||||
bool insert_p = false;
|
bool insert_p = false;
|
||||||
|
@ -868,8 +869,10 @@ add_method (tree type, tree method)
|
||||||
|
|
||||||
complete_p = COMPLETE_TYPE_P (type);
|
complete_p = COMPLETE_TYPE_P (type);
|
||||||
using = (DECL_CONTEXT (method) != type);
|
using = (DECL_CONTEXT (method) != type);
|
||||||
template_conv_p = (TREE_CODE (method) == TEMPLATE_DECL
|
conv_p = DECL_CONV_FN_P (method);
|
||||||
&& DECL_TEMPLATE_CONV_FN_P (method));
|
if (conv_p)
|
||||||
|
template_conv_p = (TREE_CODE (method) == TEMPLATE_DECL
|
||||||
|
&& DECL_TEMPLATE_CONV_FN_P (method));
|
||||||
|
|
||||||
method_vec = CLASSTYPE_METHOD_VEC (type);
|
method_vec = CLASSTYPE_METHOD_VEC (type);
|
||||||
if (!method_vec)
|
if (!method_vec)
|
||||||
|
@ -901,7 +904,6 @@ add_method (tree type, tree method)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool conv_p = DECL_CONV_FN_P (method);
|
|
||||||
tree m;
|
tree m;
|
||||||
|
|
||||||
insert_p = true;
|
insert_p = true;
|
||||||
|
@ -1012,7 +1014,7 @@ add_method (tree type, tree method)
|
||||||
/* Add the new binding. */
|
/* Add the new binding. */
|
||||||
overload = build_overload (method, current_fns);
|
overload = build_overload (method, current_fns);
|
||||||
|
|
||||||
if (slot >= CLASSTYPE_FIRST_CONVERSION_SLOT && !complete_p)
|
if (!conv_p && slot >= CLASSTYPE_FIRST_CONVERSION_SLOT && !complete_p)
|
||||||
push_class_level_binding (DECL_NAME (method), overload);
|
push_class_level_binding (DECL_NAME (method), overload);
|
||||||
|
|
||||||
if (insert_p)
|
if (insert_p)
|
||||||
|
|
|
@ -2192,10 +2192,11 @@ struct lang_decl GTY(())
|
||||||
|
|
||||||
/* For a template instantiation TYPE, returns the TYPE corresponding
|
/* For a template instantiation TYPE, returns the TYPE corresponding
|
||||||
to the primary template. Otherwise returns TYPE itself. */
|
to the primary template. Otherwise returns TYPE itself. */
|
||||||
#define CLASSTYPE_PRIMARY_TEMPLATE_TYPE(TYPE) \
|
#define CLASSTYPE_PRIMARY_TEMPLATE_TYPE(TYPE) \
|
||||||
((CLASSTYPE_USE_TEMPLATE ((TYPE)) && !CLASSTYPE_TEMPLATE_SPECIALIZATION ((TYPE))) \
|
((CLASSTYPE_USE_TEMPLATE ((TYPE)) \
|
||||||
? TREE_TYPE (DECL_TEMPLATE_RESULT (DECL_PRIMARY_TEMPLATE \
|
&& !CLASSTYPE_TEMPLATE_SPECIALIZATION ((TYPE))) \
|
||||||
(CLASSTYPE_TI_TEMPLATE ((TYPE))))) \
|
? TREE_TYPE (DECL_TEMPLATE_RESULT (DECL_PRIMARY_TEMPLATE \
|
||||||
|
(CLASSTYPE_TI_TEMPLATE ((TYPE))))) \
|
||||||
: (TYPE))
|
: (TYPE))
|
||||||
|
|
||||||
/* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
|
/* Like DECL_TI_TEMPLATE, but for an ENUMERAL_, RECORD_, or UNION_TYPE. */
|
||||||
|
|
|
@ -713,19 +713,17 @@ dump_decl (tree t, int flags)
|
||||||
switch (TREE_CODE (t))
|
switch (TREE_CODE (t))
|
||||||
{
|
{
|
||||||
case TYPE_DECL:
|
case TYPE_DECL:
|
||||||
{
|
/* Don't say 'typedef class A' */
|
||||||
/* Don't say 'typedef class A' */
|
if (DECL_ARTIFICIAL (t))
|
||||||
if (DECL_ARTIFICIAL (t))
|
{
|
||||||
{
|
if ((flags & TFF_DECL_SPECIFIERS)
|
||||||
if ((flags & TFF_DECL_SPECIFIERS)
|
&& TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM)
|
||||||
&& TREE_CODE (TREE_TYPE (t)) == TEMPLATE_TYPE_PARM)
|
/* Say `class T' not just `T'. */
|
||||||
/* Say `class T' not just `T'. */
|
pp_cxx_identifier (cxx_pp, "class");
|
||||||
pp_cxx_identifier (cxx_pp, "class");
|
|
||||||
|
dump_type (TREE_TYPE (t), flags);
|
||||||
dump_type (TREE_TYPE (t), flags);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
if (flags & TFF_DECL_SPECIFIERS)
|
if (flags & TFF_DECL_SPECIFIERS)
|
||||||
pp_cxx_identifier (cxx_pp, "typedef");
|
pp_cxx_identifier (cxx_pp, "typedef");
|
||||||
dump_simple_decl (t, DECL_ORIGINAL_TYPE (t)
|
dump_simple_decl (t, DECL_ORIGINAL_TYPE (t)
|
||||||
|
|
|
@ -1,3 +1,8 @@
|
||||||
|
2004-12-17 Nathan Sidwell <nathan@codesourcery.com>
|
||||||
|
|
||||||
|
PR c++/17821
|
||||||
|
* g++.dg/lookup/conv-5.C: New.
|
||||||
|
|
||||||
2004-12-16 Ziemowit Laski <zlaski@apple.com>
|
2004-12-16 Ziemowit Laski <zlaski@apple.com>
|
||||||
|
|
||||||
* objc.dg/stabs-1.m: New test.
|
* objc.dg/stabs-1.m: New test.
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
// { dg-do compile }
|
||||||
|
|
||||||
|
// Copyright (C) 2004 Free Software Foundation, Inc.
|
||||||
|
// Contributed by Nathan Sidwell 17 Dec 2004 <nathan@codesourcery.com>
|
||||||
|
|
||||||
|
// PR 17821. bogus error
|
||||||
|
// Origin: Mikael Kilpel?inen <belz@kolumbus.fi>
|
||||||
|
|
||||||
|
struct A {
|
||||||
|
template<typename T>
|
||||||
|
operator T() const;
|
||||||
|
|
||||||
|
operator float() const;
|
||||||
|
};
|
||||||
|
|
Loading…
Reference in New Issue