summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-07 22:27:01 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2006-09-07 22:27:01 +0000
commitc7b3b921845a8ed01b7e597161dfcec066015ddb (patch)
treed2249bf48adeec00d2548ad5cf93cb5b26ad58df
parent617ea841b7c23f6c9077b0367537bcac10ef6cc4 (diff)
downloadgcc-c7b3b921845a8ed01b7e597161dfcec066015ddb.tar.gz
PR c++/26195
* decl.c (make_rtl_for_nonlocal_decl), (start_preparsed_function): Don't use lbasename on input_filename when calling get_fileinfo. * semantics.c (begin_class_definition): Likewise. * lex.c (cxx_make_type): Likewise. (handle_pragma_interface): Call get_fileinfo on input_filename, not on the parameter to the directive. PR c++/26696 * cvt.c (convert_to_void): Replace a subexpression with no side effects with void_zero_node. * tree.c (is_overloaded_fn): Look through COMPONENT_REF. (get_first_fn): Ditto. * decl.c (grokdeclarator): No need to look through COMPONENT_REF. PR c++/26571 * parser.c (cp_parser_diagnose_invalid_type_name): Handle the case where the name is a type used incorrectly. PR c++/26671 * typeck.c (maybe_warn_about_returning_address_of_local): Look through COMPONENT_REF and ARRAY_REF. PR c++/26102 * name-lookup.c (do_class_using_decl): Try to find the base even if bases_dependent_p. * pt.c (type_dependent_expression_p): A USING_DECL is dependent. PR c++/19809 * pt.c (tsubst_friend_function): Set DECL_INITIAL before pushdecl. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_1-branch@116763 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog38
-rw-r--r--gcc/cp/cvt.c2
-rw-r--r--gcc/cp/decl.c6
-rw-r--r--gcc/cp/lex.c4
-rw-r--r--gcc/cp/name-lookup.c13
-rw-r--r--gcc/cp/parser.c3
-rw-r--r--gcc/cp/pt.c7
-rw-r--r--gcc/cp/semantics.c2
-rw-r--r--gcc/cp/tree.c5
-rw-r--r--gcc/cp/typeck.c4
10 files changed, 69 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5919abf516e..9b21e593bd6 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,41 @@
+2006-09-06 Zak Kipling <zak@transversal.com>
+
+ PR c++/26195
+ * decl.c (make_rtl_for_nonlocal_decl),
+ (start_preparsed_function): Don't use lbasename on
+ input_filename when calling get_fileinfo.
+ * semantics.c (begin_class_definition): Likewise.
+ * lex.c (cxx_make_type): Likewise.
+ (handle_pragma_interface): Call get_fileinfo on input_filename,
+ not on the parameter to the directive.
+
+2006-09-06 Jason Merrill <jason@redhat.com>
+
+ PR c++/26696
+ * cvt.c (convert_to_void): Replace a subexpression with no side
+ effects with void_zero_node.
+ * tree.c (is_overloaded_fn): Look through COMPONENT_REF.
+ (get_first_fn): Ditto.
+ * decl.c (grokdeclarator): No need to look through COMPONENT_REF.
+
+2006-09-05 Jason Merrill <jason@redhat.com>
+
+ PR c++/26571
+ * parser.c (cp_parser_diagnose_invalid_type_name): Handle the case
+ where the name is a type used incorrectly.
+
+ PR c++/26671
+ * typeck.c (maybe_warn_about_returning_address_of_local): Look
+ through COMPONENT_REF and ARRAY_REF.
+
+ PR c++/26102
+ * name-lookup.c (do_class_using_decl): Try to find the base even
+ if bases_dependent_p.
+ * pt.c (type_dependent_expression_p): A USING_DECL is dependent.
+
+ PR c++/19809
+ * pt.c (tsubst_friend_function): Set DECL_INITIAL before pushdecl.
+
2006-09-02 Jakub Jelinek <jakub@redhat.com>
PR c++/28878
diff --git a/gcc/cp/cvt.c b/gcc/cp/cvt.c
index 612b712b92e..6d0fc552492 100644
--- a/gcc/cp/cvt.c
+++ b/gcc/cp/cvt.c
@@ -959,6 +959,8 @@ convert_to_void (tree expr, const char *implicit)
}
expr = build1 (CONVERT_EXPR, void_type_node, expr);
}
+ if (! TREE_SIDE_EFFECTS (expr))
+ expr = void_zero_node;
return expr;
}
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 988c9f6ec0d..af135cf70b3 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -4798,7 +4798,7 @@ make_rtl_for_nonlocal_decl (tree decl, tree init, const char* asmspec)
{
/* Fool with the linkage of static consts according to #pragma
interface. */
- struct c_fileinfo *finfo = get_fileinfo (lbasename (filename));
+ struct c_fileinfo *finfo = get_fileinfo (filename);
if (!finfo->interface_unknown && !TREE_PUBLIC (decl))
{
TREE_PUBLIC (decl) = 1;
@@ -6864,8 +6864,6 @@ grokdeclarator (const cp_declarator *declarator,
tree fns = TREE_OPERAND (decl, 0);
dname = fns;
- if (TREE_CODE (dname) == COMPONENT_REF)
- dname = TREE_OPERAND (dname, 1);
if (TREE_CODE (dname) != IDENTIFIER_NODE)
{
gcc_assert (is_overloaded_fn (dname));
@@ -10207,7 +10205,7 @@ start_preparsed_function (tree decl1, tree attrs, int flags)
struct cp_binding_level *bl;
tree current_function_parms;
struct c_fileinfo *finfo
- = get_fileinfo (lbasename (LOCATION_FILE (DECL_SOURCE_LOCATION (decl1))));
+ = get_fileinfo (LOCATION_FILE (DECL_SOURCE_LOCATION (decl1)));
bool honor_interface;
/* Sanity check. */
diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c
index ce56265da39..8f40e736ccd 100644
--- a/gcc/cp/lex.c
+++ b/gcc/cp/lex.c
@@ -504,7 +504,7 @@ handle_pragma_interface (cpp_reader* dfile ATTRIBUTE_UNUSED )
else
filename = ggc_strdup (TREE_STRING_POINTER (fname));
- finfo = get_fileinfo (filename);
+ finfo = get_fileinfo (input_filename);
if (impl_file_chain == 0)
{
@@ -810,7 +810,7 @@ cxx_make_type (enum tree_code code)
/* Set up some flags that give proper default behavior. */
if (IS_AGGR_TYPE_CODE (code))
{
- struct c_fileinfo *finfo = get_fileinfo (lbasename (input_filename));
+ struct c_fileinfo *finfo = get_fileinfo (input_filename);
SET_CLASSTYPE_INTERFACE_UNKNOWN_X (t, finfo->interface_unknown);
CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only;
}
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index da4d5834c66..20eeb645463 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -2810,18 +2810,19 @@ do_class_using_decl (tree scope, tree name)
class type. However, if all of the base classes are
non-dependent, then we can avoid delaying the check until
instantiation. */
- if (!scope_dependent_p && !bases_dependent_p)
+ if (!scope_dependent_p)
{
base_kind b_kind;
- tree binfo;
binfo = lookup_base (current_class_type, scope, ba_any, &b_kind);
if (b_kind < bk_proper_base)
{
- error_not_base_type (scope, current_class_type);
- return NULL_TREE;
+ if (!bases_dependent_p)
+ {
+ error_not_base_type (scope, current_class_type);
+ return NULL_TREE;
+ }
}
-
- if (!name_dependent_p)
+ else if (!name_dependent_p)
{
decl = lookup_member (binfo, name, 0, false);
if (!decl)
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 373b62bbc7f..9d85a5bdd7b 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -2116,6 +2116,9 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree scope, tree id)
error ("invalid use of template-name %qE without an argument list", decl);
else if (TREE_CODE (id) == BIT_NOT_EXPR)
error ("invalid use of destructor %qD as a type", id);
+ else if (TREE_CODE (decl) == TYPE_DECL)
+ /* Something like 'unsigned A a;' */
+ error ("invalid combination of multiple type-specifiers");
else if (!parser->scope)
{
/* Issue an error message. */
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 633250e7d3a..694c421a6c3 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -5270,6 +5270,10 @@ tsubst_friend_function (tree decl, tree args)
else
new_friend_result_template_info = NULL_TREE;
+ /* Make the init_value nonzero so pushdecl knows this is a defn. */
+ if (new_friend_is_defn)
+ DECL_INITIAL (new_friend) = error_mark_node;
+
/* Inside pushdecl_namespace_level, we will push into the
current namespace. However, the friend function should go
into the namespace of the template. */
@@ -12600,7 +12604,8 @@ type_dependent_expression_p (tree expression)
return false;
/* An unresolved name is always dependent. */
- if (TREE_CODE (expression) == IDENTIFIER_NODE)
+ if (TREE_CODE (expression) == IDENTIFIER_NODE
+ || TREE_CODE (expression) == USING_DECL)
return true;
/* Some expression forms are never type-dependent. */
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index dc58a078701..58c81437dc4 100644
--- a/gcc/cp/semantics.c
+++ b/gcc/cp/semantics.c
@@ -2202,7 +2202,7 @@ begin_class_definition (tree t)
before. */
if (! TYPE_ANONYMOUS_P (t))
{
- struct c_fileinfo *finfo = get_fileinfo (lbasename (input_filename));
+ struct c_fileinfo *finfo = get_fileinfo (input_filename);
CLASSTYPE_INTERFACE_ONLY (t) = finfo->interface_only;
SET_CLASSTYPE_INTERFACE_UNKNOWN_X
(t, finfo->interface_unknown);
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 3d28436e185..f71617ad816 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -827,7 +827,8 @@ int
is_overloaded_fn (tree x)
{
/* A baselink is also considered an overloaded function. */
- if (TREE_CODE (x) == OFFSET_REF)
+ if (TREE_CODE (x) == OFFSET_REF
+ || TREE_CODE (x) == COMPONENT_REF)
x = TREE_OPERAND (x, 1);
if (BASELINK_P (x))
x = BASELINK_FUNCTIONS (x);
@@ -856,6 +857,8 @@ get_first_fn (tree from)
{
gcc_assert (is_overloaded_fn (from));
/* A baselink is also considered an overloaded function. */
+ if (TREE_CODE (from) == COMPONENT_REF)
+ from = TREE_OPERAND (from, 1);
if (BASELINK_P (from))
from = BASELINK_FUNCTIONS (from);
return OVL_CURRENT (from);
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index ddc73337569..9e8a0187371 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -6234,6 +6234,10 @@ maybe_warn_about_returning_address_of_local (tree retval)
}
}
+ while (TREE_CODE (whats_returned) == COMPONENT_REF
+ || TREE_CODE (whats_returned) == ARRAY_REF)
+ whats_returned = TREE_OPERAND (whats_returned, 0);
+
if (DECL_P (whats_returned)
&& DECL_NAME (whats_returned)
&& DECL_FUNCTION_SCOPE_P (whats_returned)