re PR c++/13975 (ICE on misplaced visibility specifier.)
PR c++/13975 * tree.h (enum tree_index): Add TI_PUBLIC, TI_PROTECTED, and TI_PRIVATE. (access_public_node): Redefine. (access_protected_node): Likewise. (access_private_node): Likewise. * tree.c (build_common_tree_nodes): Create access_public_node, access_protected_node, and access_private_node. PR c++/13978 * pt.c (build_non_dependent_expr): Do not build NON_DEPENDENT_EXPRs for FUNCTION_DECLs or TEMPLATE_DECLs. PR c++/13968 * semantics.c (finish_id_expression): Do not return an IDENTIFIER_NODE when lookup finds a VAR_DECL. PR c++/13975 * parser.c (cp_parser_simple_declaration): When skipping to the end of the statement swallow the terminating semicolon. PR c++/13978 * g++.dg/template/koenig4.C: New test. PR c++/13968 * g++.dg/template/crash17.C: New test. PR c++/13975 * g++.dg/parse/error13.C: New test. * g++.old-deja/g++.robertl/eb125.C: Tweak error messages. From-SVN: r77176
This commit is contained in:
parent
0263e6bf3c
commit
5a98fa7bdb
@ -1,3 +1,14 @@
|
||||
2004-02-03 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/13975
|
||||
* tree.h (enum tree_index): Add TI_PUBLIC, TI_PROTECTED, and
|
||||
TI_PRIVATE.
|
||||
(access_public_node): Redefine.
|
||||
(access_protected_node): Likewise.
|
||||
(access_private_node): Likewise.
|
||||
* tree.c (build_common_tree_nodes): Create access_public_node,
|
||||
access_protected_node, and access_private_node.
|
||||
|
||||
2004-02-03 Steve Ellcey <sje@cup.hp.com>
|
||||
|
||||
* config/ia64/ia64.h (MASK_INLINE_INT_DIV_LAT): Change value.
|
||||
|
@ -1,3 +1,17 @@
|
||||
2004-02-03 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/13978
|
||||
* pt.c (build_non_dependent_expr): Do not build
|
||||
NON_DEPENDENT_EXPRs for FUNCTION_DECLs or TEMPLATE_DECLs.
|
||||
|
||||
PR c++/13968
|
||||
* semantics.c (finish_id_expression): Do not return an
|
||||
IDENTIFIER_NODE when lookup finds a VAR_DECL.
|
||||
|
||||
PR c++/13975
|
||||
* parser.c (cp_parser_simple_declaration): When skipping to the
|
||||
end of the statement swallow the terminating semicolon.
|
||||
|
||||
2004-02-02 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/13113
|
||||
|
@ -6506,6 +6506,9 @@ cp_parser_simple_declaration (cp_parser* parser,
|
||||
cp_parser_error (parser, "expected `,' or `;'");
|
||||
/* Skip tokens until we reach the end of the statement. */
|
||||
cp_parser_skip_to_end_of_statement (parser);
|
||||
/* If the next token is now a `;', consume it. */
|
||||
if (cp_lexer_next_token_is (parser->lexer, CPP_SEMICOLON))
|
||||
cp_lexer_consume_token (parser->lexer);
|
||||
goto done;
|
||||
}
|
||||
/* After the first time around, a function-definition is not
|
||||
|
@ -12027,7 +12027,9 @@ build_non_dependent_expr (tree expr)
|
||||
return expr;
|
||||
/* Preserve OVERLOADs; the functions must be available to resolve
|
||||
types. */
|
||||
if (TREE_CODE (expr) == OVERLOAD)
|
||||
if (TREE_CODE (expr) == OVERLOAD
|
||||
|| TREE_CODE (expr) == FUNCTION_DECL
|
||||
|| TREE_CODE (expr) == TEMPLATE_DECL)
|
||||
return expr;
|
||||
/* Preserve string constants; conversions from string constants to
|
||||
"char *" are allowed, even though normally a "const char *"
|
||||
|
@ -2524,6 +2524,11 @@ finish_id_expression (tree id_expression,
|
||||
if (integral_constant_expression_p)
|
||||
*non_integral_constant_expression_p = true;
|
||||
*idk = CP_ID_KIND_UNQUALIFIED_DEPENDENT;
|
||||
/* If we found a variable, then name lookup during the
|
||||
instantiation will always resolve to the same VAR_DECL
|
||||
(or an instantiation thereof). */
|
||||
if (TREE_CODE (decl) == VAR_DECL)
|
||||
return decl;
|
||||
return id_expression;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,15 @@
|
||||
2004-02-03 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
PR c++/13978
|
||||
* g++.dg/template/koenig4.C: New test.
|
||||
|
||||
PR c++/13968
|
||||
* g++.dg/template/crash17.C: New test.
|
||||
|
||||
PR c++/13975
|
||||
* g++.dg/parse/error13.C: New test.
|
||||
* g++.old-deja/g++.robertl/eb125.C: Tweak error messages.
|
||||
|
||||
2004-02-03 Eric Botcazou <ebotcazou@libertysurf.fr>
|
||||
|
||||
* gcc.dg/20020503-1.c: Remove -mflat dg-options.
|
||||
|
19
gcc/testsuite/g++.dg/template/crash17.C
Normal file
19
gcc/testsuite/g++.dg/template/crash17.C
Normal file
@ -0,0 +1,19 @@
|
||||
template <int I>
|
||||
struct A {
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct B {
|
||||
typedef typename T::type type;
|
||||
static const type j = T::j;
|
||||
|
||||
A<j> b;
|
||||
};
|
||||
|
||||
struct C {
|
||||
typedef int type;
|
||||
static const int j = 3;
|
||||
};
|
||||
|
||||
int i = B<C>::j;
|
||||
|
12
gcc/testsuite/g++.dg/template/koenig4.C
Normal file
12
gcc/testsuite/g++.dg/template/koenig4.C
Normal file
@ -0,0 +1,12 @@
|
||||
// PR c++/13978
|
||||
|
||||
namespace ns {
|
||||
template <class TP> void func1(TP* t);
|
||||
struct A {};
|
||||
}
|
||||
|
||||
template < class TP >
|
||||
void func2() {
|
||||
func1( new ns::A() );
|
||||
}
|
||||
|
@ -17,6 +17,6 @@ class test_square
|
||||
template <class BOX> void test(BOX *the_box) // { dg-error "" } semicolon missing
|
||||
{x
|
||||
the_box->print();
|
||||
}; // { dg-error "" }
|
||||
};
|
||||
|
||||
template void test<> (test_box *); // { dg-error "" }
|
||||
|
@ -4917,6 +4917,10 @@ build_common_tree_nodes (int signed_char)
|
||||
unsigned_intSI_type_node = make_unsigned_type (GET_MODE_BITSIZE (SImode));
|
||||
unsigned_intDI_type_node = make_unsigned_type (GET_MODE_BITSIZE (DImode));
|
||||
unsigned_intTI_type_node = make_unsigned_type (GET_MODE_BITSIZE (TImode));
|
||||
|
||||
access_public_node = get_identifier ("public");
|
||||
access_protected_node = get_identifier ("protected");
|
||||
access_private_node = get_identifier ("private");
|
||||
}
|
||||
|
||||
/* Call this function after calling build_common_tree_nodes and set_sizetype.
|
||||
|
10
gcc/tree.h
10
gcc/tree.h
@ -1816,6 +1816,10 @@ enum tree_index
|
||||
TI_BITSIZE_ONE,
|
||||
TI_BITSIZE_UNIT,
|
||||
|
||||
TI_PUBLIC,
|
||||
TI_PROTECTED,
|
||||
TI_PRIVATE,
|
||||
|
||||
TI_BOOLEAN_FALSE,
|
||||
TI_BOOLEAN_TRUE,
|
||||
|
||||
@ -1901,9 +1905,9 @@ extern GTY(()) tree global_trees[TI_MAX];
|
||||
#define bitsize_unit_node global_trees[TI_BITSIZE_UNIT]
|
||||
|
||||
/* Base access nodes. */
|
||||
#define access_public_node NULL_TREE
|
||||
#define access_protected_node size_zero_node
|
||||
#define access_private_node size_one_node
|
||||
#define access_public_node global_trees[TI_PUBLIC]
|
||||
#define access_protected_node global_trees[TI_PROTECTED]
|
||||
#define access_private_node global_trees[TI_PRIVATE]
|
||||
|
||||
#define null_pointer_node global_trees[TI_NULL_POINTER]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user