Ian Lance Taylor
2a67bec24f
re PR c++/19564 (-Wparentheses does not work with the C++ front-end)
...
PR c++/19564
PR c++/19756
gcc/:
* c-typeck.c (parser_build_binary_op): Move parentheses warnings
to warn_about_parentheses in c-common.c.
* c-common.c (warn_about_parentheses): New function.
* c-common.h (warn_about_parentheses): Declare.
* doc/invoke.texi (Warning Options): Update -Wparentheses
description.
gcc/cp/:
* parser.c (cp_parser_expression_stack_entry): Add field
lhs_type.
(cp_parser_binary_expression): Track tree code of left hand side
of expression. Use it when calling build_x_binary_op.
(cp_parser_selection_statement): Add if_p parameter. Change all
callers. Warn about ambiguous else.
(cp_parser_statement): Add if_p parameter. Change all callers.
(cp_parser_implicitly_scoped_statement): Likewise.
* typeck.c (build_x_binary_op): Add parameters arg1_code and
arg2_code. Change all callers. Call warn_about_parentheses.
* cp-tree.h (build_x_binary_op): Update declaration.
gcc/testsuite/:
* g++.dg/warn/Wparentheses-5.C: New test.
* g++.dg/warn/Wparentheses-6.C: New test.
* g++.dg/warn/Wparentheses-7.C: New test.
* g++.dg/warn/Wparentheses-8.C: New test.
* g++.dg/warn/Wparentheses-9.C: New test.
* g++.dg/warn/Wparentheses-10.C: New test.
* g++.dg/warn/Wparentheses-11.C: New test.
* g++.dg/warn/Wparentheses-12.C: New test.
* g++.dg/warn/Wparentheses-13.C: New test.
* g++.dg/warn/Wparentheses-14.C: New test.
* g++.dg/warn/Wparentheses-15.C: New test.
* g++.dg/warn/Wparentheses-16.C: New test.
* g++.dg/warn/Wparentheses-17.C: New test.
* g++.dg/warn/Wparentheses-18.C: New test.
* g++.dg/warn/Wparentheses-19.C: New test.
* g++.dg/warn/Wparentheses-20.C: New test.
* g++.dg/warn/Wparentheses-21.C: New test.
libstdc++-v3/:
* include/bits/locale_facets.tcc (num_get<>::_M_extract_float):
Add parentheses around && within || to avoid warning.
(num_get<>::_M_extract_int): Likewise.
(money_get<>::_M_extract): Likewise.
(num_get<>::do_get(iter_type, iter_type, ios_base&,
ios_base::iostate&, void*&)): Add parentheses around & within | to
avoid warning.
(num_put<>::do_put(iter_type, ios_base&, char_type, const void*)):
Likewise.
* include/bits/streambuf_iterator.h (istreambuf_iterator::equal):
Add parentheses around && within || to avoid warning.
* libsupc++/tinfo.cc (__do_dyncast): Likewise.
* src/locale.cc (locale::_S_normalize_category): Likewise.
* include/bits/stl_tree.h (_Rb_tree<>::_M_insert_unique): Add
braces to avoid ambiguous else warning.
* src/strstream.cc (strstreambuf::_M_free): Likewise.
* src/tree.cc (_Rb_tree_rebalance_for_erase): Likewise.
From-SVN: r119855
2006-12-14 05:49:06 +00:00
Mark Mitchell
9ba7a2f292
re PR c++/29732 (ICE on invalid friend declaration)
...
PR c++/29732
* cp-tree.h (DECL_USE_TEMPLATE): Mention partial specializations.
(explicit_class_specialization_p): Declare.
* pt.c (explicit_class_specialization_p): New function.
* parser.c (cp_parser_init_declarator): Check correct number of
template parameters for in-class function definitions.
(cp_parser_check_declrator_template_parameters): Stop looking for
template classes when we find an explicit specialization.
PR c++/29732
* g++.dg/template/crash65.C: New test.
* g++.dg/template/spec16.C: Tweak error markers.
From-SVN: r119649
2006-12-08 06:27:22 +00:00
Mark Mitchell
2c05d05ede
re PR c++/29733 (ICE on initialization of function type)
...
PR c++/29733
* pt.c (tsubst_decl): Disallow variables of function type.
PR c++/29733
* g++.dg/template/crash61.C: New test.
From-SVN: r119500
2006-12-04 18:08:11 +00:00
Eric Botcazou
8f6e6bf375
tree.c (walk_type_fields): Do not handle TYPE_MIN_VALUE and TYPE_MAX_VALUE for scalar types here but...
...
* tree.c (walk_type_fields): Do not handle TYPE_MIN_VALUE and
TYPE_MAX_VALUE for scalar types here but...
(walk_tree): ...there instead. Return NULL_TREE if the TYPE_DECL
is attached an error mark, and the return value of the callback
if it is not NULL_TREE.
cp/
* pt.c (for_each_template_parm_r) <INTEGER_TYPE>: New case.
Call for_each_template_parm on TYPE_MIN_VALUE and TYPE_MAX_VALUE.
testsuite/
* gnat.dg/pointer_variable_bounds.adb: New test.
* gnat.dg/pointer_variable_bounds.ads: Likewise.
* gnat.dg/pointer_variable_bounds_q.ads: Likewise.
From-SVN: r119481
2006-12-04 07:47:32 +00:00
Dirk Mueller
1891dec445
re PR c++/18313 (Missing warning for superfluous const's in return types)
...
2006-12-01 Dirk Mueller <dmueller@suse.de>
PR c++/18313
* decl.c (grokdeclarator): Warn for type qualifiers on return
type for non-dependent types.
* pt.c (tsubst_function_type): Warn for type qualifiers on
return type for dependent types.
* g++.dg/warn/Wreturn-type-4.C: New testcase.
From-SVN: r119382
2006-11-30 23:08:27 +00:00
Douglas Gregor
55a3debe44
cp-tree.def (STATIC_ASSERT): New.
...
2006-11-21 Douglas Gregor <doug.gregor@gmail.com>
* cp-tree.def (STATIC_ASSERT): New.
* cp-objcp-common.c (cp_tree_size): Handle STATIC_ASSERT.
* error.c (dump_decl): Handle STATIC_ASSERT.
* cp-tree.h (STATIC_ASSERT_CONDITION): New.
(STATIC_ASSERT_MESSAGE): New.
(STATIC_ASSERT_SOURCE_LOCATION): New.
(struct tree_static_assert): New.
(enum cp_tree_node_structure_enum): Add TS_CP_STATIC_ASSERT.
(union lang_tree_node): Add static_assertion.
(finish_static_assert): Declare.
* cxx-pretty-print.c (pp_cxx_statement): Handle STATIC_ASSERT.
(pp_cxx_declaration): Handle STATIC_ASSERT.
* pt.c (instantiate_class_template): Handle
STATIC_ASSERT members.
(tsubst_expr): Handle STATIC_ASSERT statements.
* semantics.c (finish_static_assert): New.
* lex.c (D_CPP0X): New.
(reswords): Add static_assert keyword.
(init_reswords): If not flag_cpp0x, mask out C++0x keywords.
* parser.c (cp_parser_block_declaration): Parse static
assertions.
(cp_parser_static_assert): New.
(cp_parser_member_declaration): Parse static assertions.
From-SVN: r119066
2006-11-21 20:23:03 +00:00
Mark Mitchell
a2c5ed873e
re PR c++/29518 (rejects valid template argument, enums vs templates)
...
PR c++/29518
* pt.c (coerce_template_parms): Do not skip_evaluation while
substituting template arguments.
PR c++/29518
* g++.dg/template/static28.C: New test.
From-SVN: r118767
2006-11-13 17:48:28 +00:00
Mark Mitchell
05b22df961
re PR c++/27270 (ICE in process_init_constructor_array, at cp/typeck2.c:788)
...
PR c++/27270
* decl.c (reshape_init_class): Move check for designated
to ...
* parser.c (cp_parser_initializer_list): ... here.
* pt.c (tsubst_copy_and_build): Use finish_compound_literal.
PR c++/27270
* g++.dg/ext/complit8.C: Tweak error markers.
* g++.dg/template/complit1.C: Add error marker.
From-SVN: r117832
2006-10-17 22:25:35 +00:00
Mark Mitchell
fb8549a1d7
re PR c++/27270 (ICE in process_init_constructor_array, at cp/typeck2.c:788)
...
PR c++/27270
* typeck2.c (process_init_constructor_array): Reword comment.
* pt.c (tsubst_copy_and_built): Call reshape_init before calling
digest_init.
PR c++/27270
* g++.dg/ext/complit8.C: New test.
From-SVN: r117814
2006-10-17 02:01:27 +00:00
Mark Mitchell
1082fd1084
re PR c++/28211 (wrong linkage of template argument, diagnostic could be improved)
...
PR c++/28211
* parser.c (cp_parser_template_argument): Don't consider "&var" a
possible constant-expression.
* pt.c (convert_nontype_argument): Refine handling of arguments of
pointer type.
PR c++/28211
* g++.dg/tc1/dr49.C: Tweak error messages.
* g++.dg/parse/template21.C: New test.
From-SVN: r117787
2006-10-16 17:02:07 +00:00
Mark Mitchell
51a203d95e
re PR c++/29105 (segfault in add_candidates with a non template base class and a template member function)
...
PR c++/29105
* pt.c (tsubst_baselink): Substituteinto the qualifying scope.
* semantics.c (baselink_for_fns): Build a baselink, even when
processing a template.
PR c++/29105
* g++.dg/template/member6.C: New test.
* g++.dg/parse/typename7.C: Adjust error markers.
From-SVN: r117361
2006-10-02 04:12:51 +00:00
Lee Millward
9b910171a0
re PR c++/27667 (ICE with in-class specialization)
...
PR c++/27667
* cp-tree.h (begin_specialization): Return bool instead of void.
* pt.c (check_specialization_scope): Likwise. Adjust comment.
Return false if a specialization isn't permitted in the current scope,.
(begin_specialization): Use the return value of
check_specialization_scope.
* parser.c (cp_parser_explicit_specialization): If
begin_specialization returned false, skip the rest of the
specialization.
* g++.dg/template/spec33.C: New test.
* g++.old-deja/g++.pt/spec20.C: Adjust error markers.
From-SVN: r117206
2006-09-25 19:58:10 +00:00
Lee Millward
60feef2c2d
re PR c++/27329 (ICE with misplaced expression)
...
PR c++/27329
PR c++/26938
* cp-tree.h (redeclare_class_template): Adjust declaration
to return bool instead of void.
* pt.c (redeclare_class_template): Update definition. Return
false on error.
* decl.c (xref_tag): Return error_mark_node if redeclare_class_template
returned false.
* g++.dg/template/crash58.C: New test.
* g++.dg/template/crash59.C: New test.
* g++.dg/parse/crash28.C: Adjust error markers.
* g++.dg/template/crash34.C: Likewise.
* g++.dg/template/friend31.C: Likewise.
* g++.dg/template/crash32.C: Likewise.
From-SVN: r117205
2006-09-25 19:45:34 +00:00
Simon Martin
d4a200d359
re PR c++/28284 (ICE with invalid static const variable)
...
PR c++/28284
* pt.c (fold_non_dependent_expr): Make sure expr is not dereferenced if it
is NULL.
From-SVN: r116755
2006-09-07 13:25:05 -04:00
Mark Mitchell
6ee3ffe85e
re PR c++/28903 (Rejects VLA in template class's member with using)
...
PR c++/28903
* pt.c (tsubst): Use fold_non_dependent_expr to fold array
dimensions.
PR c++/28886
* pt.c (unify): Avoid unnecessary calls to fold_build2 for array
dimensions.
From-SVN: r116736
2006-09-07 01:04:07 +00:00
Jason Merrill
b01e6d2b91
re PR c++/26102 ("using Base::member" nonsense)
...
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.
From-SVN: r116709
2006-09-05 21:15:09 -04:00
Nathan Sidwell
88525e1bd3
PR 23287 Revert my 2006-09-01 patch.
...
cp/
PR 23287 Revert my 2006-09-01 patch.
* parser.c: Reverted.
* pt.c: Reverted.
testsuite/
PR c++/23287 Revert my 2006-09-01 patch
* g++.dg/parse/dtor12.C: Remove.
From-SVN: r116679
2006-09-04 15:21:50 +00:00
Nathan Sidwell
429b876b07
re PR c++/23287 (Explicitly invoking destructor of template class in a template and is dependent)
...
cp/
PR c++/23287
* parser.c (cp_parser_id_expression): Add member_p
argument. Update all callers.
(cp_parser_unqualified_id): Likewise. Lookup a destructor name in
the object's scope, if valid.
(cp_parser_global_scope_opt): Add object_scope_valid_p. Update
callers.
(cp_parser_postfix_dot_deref_expression): Set object_scope.
* pt.c (tsubst_copy_and_build): Lookup dependent dtor name here.
testsuite/
PR c++/23287
* g++.dg/parse/dtor12.C: New.
From-SVN: r116623
2006-09-01 13:46:19 +00:00
Volker Reichelt
9ce387d9cf
re PR c++/28860 (Trouble with bound template template parameter in specialization)
...
PR c++/28860
* cp-tree.h (maybe_process_partial_specialization): Return
tree instead of void.
* parser.c (cp_parser_class_head): Use return value of
maybe_process_partial_specialization.
* pt.c (maybe_process_partial_specialization): Return error_mark_node
for broken specializations, TYPE otherwise. Check for template
template parameters.
* g++.dg/template/ttp22.C: New test.
From-SVN: r116541
2006-08-28 22:34:55 +00:00
Mark Mitchell
99f4234aa7
re PR c++/28058 (ICE in inline_forbidden_p)
...
PR c++/28058
* pt.c (register_specialization): Return error_mark_node for
specialization-after-instantiation.
* decl2.c (mark_used): Mark the main function used when one of its
clones is used.
PR c++/28058
* g++.dg/template/spec31.C: New test.
From-SVN: r116491
2006-08-27 17:45:25 +00:00
Lee Millward
0f67a82f74
re PR c++/28736 (ICE with friend of invalid template class)
...
PR c++/28736
PR c++/28737
PR c++/28738
* pt.c (process_template_parm): Store invalid template
parameters as a TREE_LIST with a TREE_VALUE of error_mark_node.
(push_inline_template_parms_recursive): Check for template
parameters having a TREE_VALUE of error_mark_node rather than
check the parameter itself.
(mangle_class_name_for_template): Likewise.
(comp_template_parms): When comparing the individual template
parameters, return 1 if either is error_mark_node.
(current_template_args): Robustify.
(redeclare_class_template): Likewise.
* g++.dg/template/void10.C: New test.
* g++.dg/template/void8.C: New test.
* g++.dg/template/void9.C: New test.
* g++.dg/template/void3.C: Adjust error markers.
* g++.dg/template/void4.C: Likewise.
* g++.dg/template/crash55.C: Likewise.
* g++.dg/template/void7.C: Likewise.
From-SVN: r116473
2006-08-26 17:41:18 +00:00
Mark Mitchell
eff3a27644
re PR c++/28588 (static private function)
...
PR c++/28588
* class.c (resolve_address_of_overloaded_function): Add
access_path parameter. Perform access checks.
(instantiate_type): Adjust call to
resolve_address_of_overloaded_function. Remove unnecessary code.
* tree.c (is_overloaded_fn): Document. Return 2 when there are
acutally multiple functions.
(really_overloaded_fn): Use is_overloaded_fn.
* mangle.c (write_expression): Handle BASELINKs.
* cp-tree.h (really_overloaded_fn): Return bool.
(baselink_for_fns): Declare.
* search.c (lookup_member): Check access for single static
functions here.
* pt.c (convert_nontype_argument_function): Handle BASELINKs.
(tsubst_copy_and_build): Generate BASELINKs for template-ids.
* semantics.c (finish_call_expr): Use baselink_for_fns.
(baselink_for_fns): New function.
(finish_id_expression): Use it.
* parser.c (cp_parser_template_argument): Don't strip BASELINKs.
PR c++/28595
* pt.c (tsubst): Issue errors about attempts to create VLAs at
template-instantiation time.
PR c++/28588
* g++.dg/inherit/access6.C: New test.
* g++.dg/inherit/access7.C: Likewise.
PR c++/28595
* g++.dg/template/array15.C: New test.
* g++.dg/template/crash2.C: Tweak error markers.
From-SVN: r116468
2006-08-26 16:23:33 +00:00
Volker Reichelt
398cd19904
re PR c++/28852 (ICE on invalid conversion operator)
...
PR c++/28852
* cp-tree.h (grok_op_properties): Return bool instead of void.
* decl.c (grokfndecl): Discard invalid operator declarations.
(copy_fn_p): Revert change for PR 27547.
(grok_op_properties): Return error status (true on success).
* pt.c (tsubst_decl): Discard invalid operator declarations.
* g++.dg/other/operator1.C: Add error-marker.
* g++.dg/other/operator2.C: New test.
From-SVN: r116463
2006-08-26 00:25:59 +00:00
Jason Merrill
c9cbfca6f5
re PR c++/27714 (operator new as friend in template class rejected)
...
PR c++/27714
* pt.c (push_template_decl_real): A friend template with class
scope isn't primary.
From-SVN: r116379
2006-08-24 11:54:39 -04:00
Mark Mitchell
015c2c66b2
re PR c++/28341 (ICE with references as template parameters)
...
PR c++/28341
* tree.c (cast_valid_in_integral_constant_expression_p): New
function.
* cp-tree.h (tsubst_copy_and_build): Adjust prototype.
* pt.c (tsubst_expr): Add integral_constant_expression_p
parameter.
(fold_non_dependent_expr): Adjust callers of
tsubst_{expr,copy_and_build}.
(tsubst_friend_function): Likewise.
(tsubst_template_arg): Likewise.
(tsubst_default_argument): Likewise.
(tsubst_decl): Likewise.
(tsubst): Likewise.
(tsubst_omp_clasuses): Likewise.
(regenerate_decl_fromp_template): Likewise.
(instantiate_decl): Likewise.
(tsubst_initializer_list): Likewise.
(tsubst_enum): Likewise.
(tsubst_expr): Use RECUR throughout.
(tsubst_copy_and_build): Change definition of RECUR. Do not allow
invalid casts in integral constant expressions.
* parser.c (cp_parser_postfix_expression): Use
cast_valid_in_integral_constant_expression_p.
(cp_parser_cast_expression): Likewise.
(cp_parser_functional_cast): Likewise.
PR c++/28346
* pt.c (tsubst_qualified_id): Do not strip references from
OFFSET_REFs.
2006-08-20 Mark Mitchell <mark@codesourcery.com>
PR c++/28341
* g++.dg/template/ref3.C: New test.
* g++.dg/template/nontype13.C: New test.
PR c++/28346
* g++.dg/template/ptrmem17.C: New test.
2006-08-20 Mark Mitchell <mark@codesourcery.com>
* objcp-lang.c (objcp_tsubst_copy_and_build): Adjust call to
tsubst_copy_and_build.
From-SVN: r116276
2006-08-20 23:53:10 +00:00
Volker Reichelt
a97728cfa9
re PR c++/28711 (ICE on invalid initializer for multidimensional array)
...
PR c++/28711
* pt.c (tsubst_copy_and_build) <case CONSTRUCTOR>: Robustify.
* g++.dg/template/ctor8.C: New test.
From-SVN: r116210
2006-08-17 08:02:39 +00:00
Jason Merrill
9180c238de
re PR c++/28385 (templated function call goes awry)
...
PR c++/28385
* pt.c (tsubst) [TEMPLATE_TYPE_PARM]: Ignore quals from template
if arg is a function.
From-SVN: r116203
2006-08-16 20:51:37 -04:00
Lee Millward
d47e3adf1d
re PR c++/28594 (ICE with invalid template parameter)
...
PR c++/28594
* pt.c (process_template_parm): Robustify.
* g++.dg/template/void6.C: New test.
From-SVN: r116160
2006-08-15 17:21:09 +00:00
Lee Millward
2d8ba2c76b
re PR c++/28637 (ICE on invalid template parameter)
...
2006-08-09 Lee Millward <lee.millward@codesourcery.com>
PR c++/28637
* pt.c (coerce_template_parms): Copy across the
invalid template arguments to the new template inner arguments.
(retrieve_specialization): Robustify.
* g++.dg/template/void3.C: New test.
PR c++/28638
* pt.c (coerce_template_template_parms): Robustify.
* g++.dg/template/void4.C: New test.
PR c++/28639
* error.c (dump_template_parms): Robustify.
PR c++/28640
* pt.c (redeclare_class_template): Robustify
* g++.dg/template/void5.C: New test.
PR c++/28641
* pt.c (type_unification_real): Robustify.
From-SVN: r116043
2006-08-09 18:43:06 +00:00
Mark Mitchell
6f67f00022
re PR c++/28557 (Trouble with templated type conversion operator)
...
PR c++/28557
* pt.c (tsubst_baselink): Substitute into BASELINK_OPTYPE.
PR c++/28557
* g++.dg/template/conv9.C: New test.
From-SVN: r115886
2006-08-02 20:35:41 +00:00
Daniel Jacobowitz
6193b8b7ed
re PR debug/23336 (enum constants not visible to gdb because of -feliminate-unused-debug-types)
...
gcc/
PR debug/23336
* c-typeck.c (build_external_type): Mark used enum types.
* dwarf2out.c (dwarf2out_abstract_function): Save and restore
cfun also.
(gen_subprogram_die): Whitespace fix.
gcc/cp/
PR debug/23336
* pt.c (tsubst_copy_and_build): Mark used enum types.
* semantics.c (finish_id_expression): Likewise.
gcc/testsuite/
PR debug/23336
* lib/gcc-dg.exp (gcc-dg-debug-runtest): Suppress new tests
at -g1.
* gcc.dg/debug/enum-1.c, g++.dg/debug/enum-1.C,
g++.dg/debug/enum-2.C: New.
From-SVN: r115853
2006-08-01 14:23:58 +00:00
Lee Millward
42b304f1ce
re PR c++/27668 (ICE with invalid template parameter)
...
PR c++/27668
PR c++/27962
* pt.c (process_template_parm) Store invalid template
parameters as error_mark_node in the paramater list.
(push_inline_template_parms_recursive): Handle invalid
template parameters.
(comp_template_parms): Likewise.
(check_default_tmpl_arg): Likewise.
(coerce_template_template_parms): Likewise.
(mangle_class_name_for_template): Likewise.
(tsubst_template_parms): Likewise.
* error.c (dump_template_argument_list): Likewise.
* g++.dg/template/crash55.C: New test.
* g++.dg/template/nontype16.C: New test.
* g++.dg/template/void2.C: Adjust error markers.
* g++.dg/template/nontype5.C: Adjust error markers.
From-SVN: r115800
2006-07-28 17:01:19 +00:00
Daniel Jacobowitz
74b0d490fa
re PR c++/28460 (g++ emits bogus namespace DIE)
...
PR c++/28460
* decl.c (grokvardecl): Use FROB_CONTEXT.
* pt.c (register_specialization): Likewise.
From-SVN: r115703
2006-07-24 02:58:08 +00:00
Mark Mitchell
105d72c595
re PR c++/28025 (multiple template friend compile error)
...
PR c++/28025
* cp-tree.h (LOOKUP_HIDDEN): New macro. Reformat comments.
* name-lookup.c (unqualified_namespace_lookup): There is no way to
have a hidden name in non-namespace scopes.
* pt.c (tsubst_friend_class): Look for hidden names.
* decl.c (lookup_and_check_tag): Fix typo in comment.
* semantics.c (finish_compound_literal): Fix typo in comment.
PR c++/28025
* g++.dg/template/friend45.C: New test.
From-SVN: r115687
2006-07-23 20:28:26 +00:00
Volker Reichelt
3a2419a7ec
re PR c++/28250 (ICE with invalid catch)
...
PR c++/28250
* pt.c (tsubst_expr): Only apply DECL_TEMPLATE_INSTANTIATED to
valid decls. Cleanup.
* g++.dg/eh/catch3.C: New test.
From-SVN: r115643
2006-07-21 09:59:57 +00:00
Jason Merrill
b70f0f48c7
re PR c++/28407 (Issue with anonymous namespace)
...
PR c++/28407
* cp/decl.c (grokvardecl): Set DECL_THIS_STATIC on file-scope
const variables with implicit internal linkage.
* cp/tree.c (decl_linkage): Only return lk_external if it's set.
PR c++/28409
* cp/decl2.c (constrain_visibility): Ignore the anonymous namespace
for extern C decls.
(VISIBILITY_STATIC): Rename to VISIBILITY_ANON.
Don't override explicit visibility.
* cp/decl2.c (constrain_visibility): Remove specified and reason
parameters. Don't touch decls that already have explicit visibility.
(determine_visibility): Do copy DECL_VISIBILITY_SPECIFIED from
template.
(determine_visibility_from_class): Reverse sense of
DECL_VISIBILITY_SPECIFIED test for target-specific visibility rules.
(constrain_class_visibility): Only complain about member visibility
if the member type is another class. Don't change visibility of the
current class.
* tree.c (remove_attribute): New fn.
* tree.h: Declare it.
From-SVN: r115622
2006-07-20 12:02:57 -04:00
Mark Mitchell
f604fc3b2e
re PR c++/28235 (ICE with static const member as default parameter in template)
...
PR c++/28235
* pt.c (tsubst_decl): Handling substitutions into a static data
member from within the scope of the tempalte itself.
PR c++/28235
* g++.dg/template/static27.C: New test.
From-SVN: r115576
2006-07-19 00:22:43 +00:00
Jason Merrill
b9e7569630
re PR c++/26905 (default-visibility class symbol improperly resolved as hidden-visibility)
...
PR c++/26905
PR c++/26612
PR c++/27000
PR c++/26984
PR c++/19134
* tree.c (build_decl_stat): Don't hande #pragma visibility here.
* c-common.c (c_determine_visibility): Handle it here.
* c-decl.c (finish_decl): Call c_determine_visibility for
functions, too.
* flags.h (enum symbol_visibility): Sort from most to least visibility.
* tree.h: Likewise.
* varasm.c (default_assemble_visibility): Likewise.
* c-common.c (handle_visibility_attribute): Complain about trying
to give visibility to an already defined class, or trying to change
declared visibility. Always attach the attribute.
* cp/decl2.c (determine_visibility): Overhaul.
(determine_visibility_from_class): Likewise.
(min_vis_r, type_visibility, constrain_visibility): New fns.
(constrain_visibility_for_template): Likewise.
(constrain_class_visibility): Likewise.
* cp/decl.c (cp_finish_decl): Call determine_visibility for function
decls, too.
* cp/name-lookup.c (pushtag): Call determine_visibility.
* cp/decl.c (duplicate_decls): Don't copy visibility from template to
specialization.
* cp/pt.c (check_explicit_specialization): Likewise.
(lookup_template_class, tsubst_decl): Call determine_visibility.
* cp/class.c (finish_struct_1): Call constrain_class_visibility.
PR c++/26905
PR c++/21675
PR c++/17470
* cp/parser.c (cp_parser_explicit_instantiation): Pass the attributes
to grokdeclarator.
(cp_parser_type_specifier): Allow 'enum __attribute ((...)) E'.
(cp_parser_enum_specifier): Likewise.
(cp_parser_elaborated_type_specifier): Apply attributes if this
declares only the class.
(cp_parser_class_specifier): Apply leading attributes immediately.
* cp/semantics.c (begin_class_definition): Add attributes parameter,
apply them to the type.
* attribs.c (decl_attributes): Ignore type-in-place attributes
once the type has been defined.
PR c++/21581
PR c++/25915
* cp/tree.c (decl_anon_ns_mem_p): New function.
* cp/cp-tree.h: Declare it.
* cp/decl2.c (determine_visibility): Make anonymous namespace
members static.
(min_vis_r, constrain_visibility): Likewise.
* cp/rtti.c (create_pseudo_type_info): Set TREE_PUBLIC on
pseudo-types.
* cp/decl.c (cxx_init_decl_processing): Set TREE_PUBLIC on
global_namespace.
* cp/name-lookup.c (push_namespace_with_attribs): Don't set TREE_PUBLIC
on anonymous namespaces.
From-SVN: r115086
2006-06-29 21:15:56 -04:00
Jason Merrill
6150b60261
re PR c++/27424 (Valid template-template-parameter rejected)
...
PR c++/27424
* pt.c (convert_template_argument): Pass all template arguments
on to coerce_template_template_parms.
From-SVN: r115063
2006-06-28 21:27:17 -04:00
Volker Reichelt
728da67271
re PR c++/28111 (ICE with invalid friend in template class)
...
PR c++/28111
* pt.c (determine_specialization): Check for invalid decls.
* g++.dg/template/friend43.C: New test.
From-SVN: r114887
2006-06-22 09:55:42 +00:00
Volker Reichelt
3e9ac7e525
re PR c++/28110 (ICE with invalid template constant parameter)
...
PR c++/28110
* pt.c (unify) <case TEMPLATE_PARM_INDEX>: Check for invalid
parameters.
* g++.dg/template/crash53.C: New test.
From-SVN: r114885
2006-06-22 09:47:51 +00:00
Mark Mitchell
a1d0899101
* pt.c (instantiate_template): Fix typo in comment.
...
From-SVN: r114788
2006-06-19 21:40:05 +00:00
Mark Mitchell
4e95268d59
re PR c++/27689 (function template incorrectly selected as candidate)
...
PR c++/27689
* cp-tree.h (CLASSTYPE_SPECIALIZATION_OF_PRIMARY_TEMPLATE_P): New
macro.
* pt.c (unify): Use it.
PR c++/27689
* g++.dg/template/ttp18.C: New test.
* g++.dg/template/ttp19.C: Likewise.
From-SVN: r114703
2006-06-16 06:08:49 +00:00
Mark Mitchell
a95799ec5f
re PR c++/27640 (segfault, related to constructor instantiation and virtual base case and templates and new operator)
...
PR c++/27640
* pt.c (instantiate_template): Set processing_template_decl to
zero while performing substitutions.
PR c++/27640
* g++.dg/template/ctor7.C: New test.
From-SVN: r114701
2006-06-16 02:09:10 +00:00
Mark Mitchell
fe89d79748
re PR c++/26559 (ICE with __builtin_constant_p in template argument)
...
2006-06-14 Mark Mitchell <mark@codesourcery.com>
PR c++/26559
* c-common.h (c_finish_omp_atomic): Adjust declaration.
* c-omp.c (c_finish_omp_atomic): Return the expression to perform,
rather than calling add_stmt on it.
* c-parser.c (c_parser_omp_atomic): Adjust accordingly.
2006-06-14 Mark Mitchell <mark@codesourcery.com>
PR c++/26559
* pt.c (tsubst_expr): Use finish_omp_atomic.
(value_dependent_expression_p): All CALL_EXPRs are dependent.
* semantics.c (finish_omp_atomic): Rework to use standard
paradigms for handling non-dependent expressions.
2006-06-14 Mark Mitchell <mark@codesourcery.com>
PR c++/26559
* g++.dg/template/builtin1.C: New test.
* g++.dg/gomp/tpl-atomic-2.C: Remove XFAIL.
From-SVN: r114665
2006-06-15 03:26:38 +00:00
Volker Reichelt
c291f8b146
re PR c++/27601 (ICE (in fold_offsetof_1, at c-common.c:5998) on strange offsetof)
...
PR c++/27601
* cp-tree.h (finish_offsetof): Add prototype.
* semantics.c (finish_offsetof): New function.
* parser.c (cp_parser_builtin_offsetof): Call it instead of
fold_offsetof.
* pt.c (tsubst_copy_and_build): Likewise.
* g++.dg/ext/offsetof1.C: Test member functions.
From-SVN: r114469
2006-06-07 16:08:30 +00:00
Mike Stump
3db45ab592
Fix up whitespacing
...
From-SVN: r114428
2006-06-06 11:44:09 +00:00
Kazu Hirata
944fd207f5
pt.c (convert_nontype_argument): Fix a typo in an error message.
...
* pt.c (convert_nontype_argument): Fix a typo in an error
message.
From-SVN: r114185
2006-05-29 05:33:28 +00:00
Mark Mitchell
e92fb50114
re PR c++/20103 (ICE in create_tmp_var with C99 style struct initializer)
...
PR c++/20103
* gimplify.c (gimplify_decl_expr): Do not call gimple_add_tmp_var
for anonymous variables explicitly declared by front ends.
PR c++/20103
* decl.c (cp_make_fname_decl): Don't set DECL_INITIAL to
error_mark_node to indicate an initialization is OK.
(start_decl): Likewise. Adjust call to start_decl_1.
(start_decl_1): Add initialized parameter. Simplify.
* except.c (initialize_handler_parm): Adjust call to
setart_decl_1.
(expand_start_catch_block): Let cp_finish_decl initialize catch
parameters.
* cp-tree.h (start_decl_1): Adjust prototype.
* pt.c (tsubst_expr): Don't set DECL_INITIAL to error_mark_node.
(instantiate_decl): Let cp_finish_decl handle initialization.
* semantics.c (finish_compound_literal): Create a temporary
variable for the literal.
* typeck.c (build_unary_op): Remove COMPOUND_LITERAL_P special
cases.
* decl2.c (finish_static_data_member_decl): Don't set
DECL_INITIAL.
(grokfield): Do not try to initialize functions.
PR c++/20103
* g++.dg/ext/complit6.C: New test.
* g++.dg/ext/complit3.C: Adjust error markers.
* g++.dg/init/const3.C: New test.
From-SVN: r114119
2006-05-25 20:18:26 +00:00
Mark Mitchell
29a1da1c30
re PR c++/20173 (gcc accepts invalid partial specialization attempt of member function)
...
PR c++/20173
* pt.c (determine_specialization): Disallow partial
specializations of templates.
PR c++/20173
* g++.dg/template/error21.C: New test.
From-SVN: r114023
2006-05-23 20:45:44 +00:00