Commit Graph

11106 Commits

Author SHA1 Message Date
Richard Biener 6184085fc6 Update ChangeLog and version files for release
From-SVN: r257041
2018-01-25 08:17:27 +00:00
Jason Merrill b4e93c5826 PR c++/81843 - ICE with variadic member template.
PR c++/72801
	* pt.c (unify_pack_expansion): Don't try to deduce enclosing
	template args.

From-SVN: r256808
2018-01-17 13:08:05 -05:00
Jason Merrill 99547487e1 PR c++/82331 - ICE with variadic partial specialization of auto
* pt.c (unify) [TEMPLATE_PARM_INDEX]: Set processing_template_decl
	around call to tsubst.

From-SVN: r256807
2018-01-17 13:07:53 -05:00
Jason Merrill d1f067b812 PR c++/82760 - memory corruption with aligned new.
* call.c (build_operator_new_call): Update *args if we add the
	align_arg.

From-SVN: r256806
2018-01-17 13:07:45 -05:00
Jakub Jelinek 27f04c8cc7 re PR c++/83556 (ICE in gimplify_expr, at gimplify.c:12004)
PR c++/83556
	* tree.c (replace_placeholders_r): Pass NULL as last argument to
	cp_walk_tree instead of d->pset.  If non-TREE_CONSTANT and
	non-PLACEHOLDER_EXPR tree has been seen already, set *walk_subtrees
	to false and return.
	(replace_placeholders): Pass NULL instead of &pset as last argument
	to cp_walk_tree.

	* g++.dg/cpp0x/pr83556.C: New test.

From-SVN: r256087
2018-01-02 19:07:41 +01:00
Marek Polacek fe513fce56 re PR c++/83116 (Statement with no effect causes wrong code of static object constexpr method)
PR c++/83116
	* constexpr.c (cxx_eval_call_expression): Only look into
	constexpr_call_table if ctx->strict.

	* g++.dg/cpp1y/constexpr-83116.C: New test.

From-SVN: r255813
2017-12-19 10:02:48 +00:00
Jakub Jelinek e8baf08f2a backport: re PR c++/83205 (ICE on structured binding with ill-formed negative std::tuple_size<T>::value)
Backported from mainline
	2017-12-15  Jakub Jelinek  <jakub@redhat.com>

	PR c++/83205
	* decl.c (cp_finish_decomp): Handle the case when tsize is not
	error_mark_node, but doesn't fit into uhwi.  Split up count != eltscnt
	and !tree_fits_uhwi_p (tsize) error_at calls into error_n and inform_n
	to handle plural forms properly.

	* g++.dg/cpp1z/decomp3.C: Adjust for structured binding count
	mismatch diagnostics split into error and warning with plural
	forms.
	* g++.dg/cpp1z/decomp10.C: Likewise.
	* g++.dg/cpp1z/decomp32.C: New test.

From-SVN: r255736
2017-12-16 01:41:10 +01:00
Jakub Jelinek c3fce73ee9 backport: re PR c++/81197 (ICE with structured binding and lifetime-extended temporaries)
Backported from mainline
	2017-12-15  Jakub Jelinek  <jakub@redhat.com>

	PR c++/81197
	* cp-tree.h (cp_maybe_mangle_decomp): Declare.
	* decl.c (cp_maybe_mangle_decomp): New function.
	(cp_finish_decomp): Don't SET_DECL_ASSEMBLER_NAME here.
	* parser.c (cp_convert_range_for,
	cp_parser_decomposition_declaration): Call cp_maybe_mangle_decomp.
	* pt.c (tsubst_expr): Likewise.
	* mangle.c (find_decomp_unqualified_name): New function.
	(write_unqualified_name): Handle DECL_DECOMPOSITION_P
	where DECL_ASSEMBLER_NAME is already set.

	* g++.dg/cpp1z/decomp34.C: New test.

From-SVN: r255735
2017-12-16 01:40:14 +01:00
Jakub Jelinek f455bd3a1d re PR c++/83217 (Compiler segfault: structured binding by reference to a templated type via a pointer)
PR c++/83217
	* decl.c (cp_finish_decomp): If decl's type is REFERENCE_TYPE,
	call complete_type (TREE_TYPE (type)).

	* g++.dg/cpp1z/decomp33.C: New test.

From-SVN: r255730
2017-12-15 23:16:15 +01:00
Jakub Jelinek a31d2f7b36 backport: re PR c++/79650 (ICE on invalid c++ code with label arithmetic in convert_nontype_argument (pt.c:6515))
Backported from mainline
	2017-12-14  Jakub Jelinek  <jakub@redhat.com>

	PR c++/79650
	* pt.c (convert_nontype_argument): Diagnose
	reduced_constant_expression_p expressions that aren't INTEGER_CST.

	* g++.dg/template/pr79650.C: New test.

From-SVN: r255727
2017-12-15 23:13:37 +01:00
Jakub Jelinek 1c8f2b0a85 backport: re PR c++/80259 (ICE deleting friend function)
Backported from mainline
	2017-12-06  Jakub Jelinek  <jakub@redhat.com>

	PR c++/80259
	* decl2.c (grokfield): Diagnose = delete redefinition of a friend.

	* g++.dg/cpp0x/pr80259.C: New test.

From-SVN: r255723
2017-12-15 23:10:40 +01:00
Jakub Jelinek d67cb7e401 backport: re PR c++/81888 (Structured bindings stopped working)
Backported from mainline
	2017-11-27  Jakub Jelinek  <jakub@redhat.com>

	PR c++/81888
	* parser.c (cp_parser_decomposition_declaration): Reject just
	BRACE_ENCLOSED_INITIALIZER_P initializers with nelts != 1 rather
	than all such CONSTRUCTORs, and only if is_direct_init is true.

	* g++.dg/cpp1z/decomp30.C: Add a test for structured binding with
	= {} and = { a, a } initializers.
	* g++.dg/cpp1z/decomp31.C: New test.

From-SVN: r255719
2017-12-15 23:07:23 +01:00
Jakub Jelinek 4c8c427fcf backport: re PR c++/81675 (attribute(noreturn) of destructor in :? not honored)
Backported from mainline
	2017-11-27  Jakub Jelinek  <jakub@redhat.com>

	PR c++/81675
	* cp-gimplify.c (cp_fold) <case COND_EXPR>: Don't return immediately
	for VOID_TYPE_P COND_EXPRs, instead fold the operands and if op0 is
	INTEGER_CST, ensure that both op1 and op2 are non-NULL and fall
	through into normal folding, otherwise just rebuild x if any op
	changed.

	* g++.dg/warn/pr81675.C: New test.

From-SVN: r255718
2017-12-15 23:06:16 +01:00
Jakub Jelinek 7c11fb2820 backport: parser.c (cp_parser_omp_declare): Change return type to bool from void, return true for declare simd.
Backported from mainline
	2017-11-23  Jakub Jelinek  <jakub@redhat.com>

	* parser.c (cp_parser_omp_declare): Change return type to bool from
	void, return true for declare simd.
	(cp_parser_pragma): Return cp_parser_omp_declare returned value
	rather than always false.

From-SVN: r255713
2017-12-15 22:56:21 +01:00
Jakub Jelinek e74d698765 backport: re PR c++/82781 (Vector extension operators return wrong result in constexpr)
Backported from mainline
	2017-11-20  Jakub Jelinek  <jakub@redhat.com>

	PR c++/82781
	* constexpr.c (cxx_eval_vector_conditional_expression): New function.
	(cxx_eval_constant_expression) <case VEC_COND_EXPR>: Use it instead
	of cxx_eval_conditional_expression.

	* g++.dg/ext/constexpr-pr82781.C: New test.

From-SVN: r255707
2017-12-15 22:50:00 +01:00
Paolo Carlini 4fb0491161 re PR c++/82085 (ICE: Template variable reference used in nested template alias)
/cp
2017-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/82085
	* pt.c (tsubst_copy_and_build, [INDIRECT_REF]): For a REFERENCE_REF_P,
	unconditionally call convert_from_reference.

/testsuite
2017-10-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/82085
	* g++.dg/cpp1y/var-templ56.C: New.

From-SVN: r254240
2017-10-30 19:17:40 +00:00
Jakub Jelinek 02a55dcbaf backport: re PR c++/82373 (syntax error in error message)
Backported from mainline
	2017-10-04  Jakub Jelinek  <jakub@redhat.com>

	PR c++/82373
	* error.c (dump_function_decl): If show_return, call dump_type_suffix
	on the same return type dump_type_prefix has been called on.

	* g++.dg/cpp1y/pr82373.C: New test.

From-SVN: r254180
2017-10-27 22:34:22 +02:00
Nathan Sidwell a203c78308 [C++ PATCH 82560] missing dtor call
https://gcc.gnu.org/ml/gcc-patches/2017-10/msg01068.html
	PR c++/82560
	* call.c (build_over_call): Don't pass tf_no_cleanup to nested
	calls.

	PR c++/82560
	* g++.dg/cpp0x/pr82560.C: New.

From-SVN: r253822
2017-10-17 17:27:11 +00:00
Jakub Jelinek a45258d20b re PR c++/82299 (-Wuseless-cast errors on typed enums used in member data initializers in c++1z)
PR c++/82299
	* decl.c (reshape_init): Suppress warn_useless_cast for direct enum
	init.
	* typeck.c (convert_for_assignment): Likewise.

	* g++.dg/cpp0x/pr82299.C: New test.

From-SVN: r253499
2017-10-06 20:00:54 +02:00
Jason Merrill 74a2b1d572 * call.c (convert_arg_to_ellipsis): Use the result of force_rvalue.
From-SVN: r253466
2017-10-05 17:43:01 -04:00
Jason Merrill 3eb1e9c89d PR c++/82406 - C++17 error with noexcept function type
PR c++/70029 - ICE with ref-qualifier and -flto
gcc/
	* langhooks.h (struct lang_hooks_for_types): Add
	copy_lang_qualifiers.
	* langhooks-def.h (LANG_HOOKS_COPY_LANG_QUALIFIERS): Default to
	NULL.
	(LANG_HOOKS_FOR_TYPES_INITIALIZER): Use it.
	* tree.c (verify_type): Re-enable TYPE_CANONICAL main variant check.
	(build_type_attribute_qual_variant): Use copy_lang_qualifiers.
gcc/cp/
	* tree.c (cxx_copy_lang_qualifiers): New.
	* cp-tree.h: Declare it.
	* cp-objcp-common.h: Define LANG_HOOKS_COPY_LANG_QUALIFIERS.

From-SVN: r253424
2017-10-04 13:47:08 -04:00
Jason Merrill 3d2be6b44d PR c++/81525 - broken handling of auto in generic lambda.
* pt.c (tsubst_decl) [VAR_DECL]: Use strip_innermost_template_args.

From-SVN: r253415
2017-10-04 11:38:24 -04:00
Eric Botcazou 0350ea29c0 re PR bootstrap/81926 (go/parse.o differs between stage2 and stage3)
PR bootstrap/81926
	* cp-objcp-common.c (cp_get_debug_type): Do only one lookup.

From-SVN: r253110
2017-09-22 20:20:40 +00:00
Jakub Jelinek c15f0c23da re PR sanitizer/81929 (exponential slowdown in undefined behavior sanitizer for streaming)
PR sanitizer/81929
	* tree.c (struct replace_placeholders_t): Add pset field.
	(replace_placeholders_r): Call cp_walk_tree with d->pset as
	last argument instead of NULL.  Formatting fix.
	(replace_placeholders): Add pset variable, add its address
	into data.  Pass &pset instead of NULL to cp_walk_tree.

	* g++.dg/ubsan/pr81929.C: New test.

From-SVN: r253108
2017-09-22 21:00:03 +02:00
Jason Merrill 4d26b83715 PR c++/81236 - ICE with template-id in generic lambda
* parser.c (parsing_default_capturing_generic_lambda): Don't check
	for enclosing template.
	* semantics.c (finish_qualified_id_expr): Call it.
	* cp-tree.h: Adjust.

From-SVN: r252946
2017-09-18 14:37:16 -04:00
Jason Merrill f16091882b PR c++/80767 - unnecessary instantiation of generic lambda
PR c++/82030 - ICE inheriting from multiple lambdas
	* call.c (convert_like_real): Call build_user_type_conversion_1 if
	cand is null.
	(add_conv_candidate): Build a ck_user conversion with no candidate.
	(compare_ics): Handle null candidate.

From-SVN: r252945
2017-09-18 14:37:10 -04:00
Jason Merrill 5de2272480 PR c++/80935 - wrong C++17 error with lambda
* decl.c (check_for_uninitialized_const_var): Check
	is_instantiation_of_constexpr.

From-SVN: r252943
2017-09-18 14:36:59 -04:00
Jason Merrill 3ef1cd3d1e PR c++/81671 - nullptr_t template parameter
* pt.c (convert_nontype_argument): Fix nullptr_t check.

From-SVN: r252942
2017-09-18 14:36:53 -04:00
Jason Merrill 3f2b67a9bb PR c++/81525 - wrong constant value with generic lambda
* pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
	(tsubst_copy) [VAR_DECL]: Handle auto.

From-SVN: r252941
2017-09-18 14:36:47 -04:00
Jakub Jelinek 33a5063b3d backport: re PR c++/81314 (Undefined reference to a function with -fopenmp)
Backported from mainline
	2017-09-14  Jakub Jelinek  <jakub@redhat.com>

	PR c++/81314
	* cp-gimplify.c (omp_var_to_track): Look through references.
	(omp_cxx_notice_variable): Likewise.

	* testsuite/libgomp.c++/pr81314.C: New test.

From-SVN: r252806
2017-09-15 13:27:07 +02:00
Eric Botcazou 753161f615 re PR bootstrap/81926 (go/parse.o differs between stage2 and stage3)
PR bootstrap/81926
	* cp-objcp-common.c (struct debug_type_hasher): New class.
	(debug_type_hash): New variable.
	(cp_get_debug_type): Associate the OFFSET_TYPEs with the types.

From-SVN: r251923
2017-09-09 09:43:33 +00:00
Marek Polacek 71a835084a re PR c++/82040 (ICE with -Wbool-operation and ~)
PR c++/82040
	* typeck.c (cp_build_unary_op): Avoid re-entering reporting routines.

	* g++.dg/warn/Wbool-operation-1.C: New test.

From-SVN: r251582
2017-09-01 09:24:54 +00:00
Marek Polacek 9bdbbf52ac re PR c++/81607 (Conditional operator: "type mismatch in shift expression" error)
PR c++/81607
	* cp-gimplify.c (cp_fold): If folding exposed a branch of
	a COND_EXPR, convert it to the original type of the COND_EXPR, if
	they differ.

From-SVN: r251358
2017-08-25 16:31:50 +00:00
Richard Biener 586a0829dc Update ChangeLog and version files for release
From-SVN: r251081
2017-08-14 07:59:11 +00:00
Jason Merrill 5b6f97c9a7 Revert "PR c++/81525 - wrong constant value with generic lambda"
From-SVN: r251002
2017-08-09 16:18:59 -04:00
Jason Merrill c02c8b11e1 PR c++/81525 - wrong constant value with generic lambda
* pt.c (tsubst_decl) [VAR_DECL]: Avoid clobbering auto.
	(tsubst_copy) [VAR_DECL]: Handle auto.

From-SVN: r251001
2017-08-09 16:17:55 -04:00
Leonid Koppel abe0604c18 PR c++/67054 - Inherited ctor with non-default-constructible members
* method.c (walk_field_subobs) Consider member initializers (NSDMIs)
	when deducing an inheriting constructor.

From-SVN: r251000
2017-08-09 16:17:47 -04:00
Paolo Carlini f5e245835a re PR c++/71570 (ICE on invalid variable capture in cxx_incomplete_type_diagnostic, at cp/typeck2.c:55)
/cp
2017-07-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71570
	* lambda.c (add_capture): Early return if we cannot capture by
	reference.

/testsuite
2017-07-27  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/71570
	* g++.dg/cpp0x/lambda/lambda-ice17.C: New.

From-SVN: r250614
2017-07-27 09:36:37 +00:00
Jakub Jelinek 96a0e28758 backport: re PR c++/81258 (ICE on C++1z code with invalid decomposition declaration: in cp_finish_decl, at cp/decl.c:6760)
Backported from mainline
	2017-07-04  Jakub Jelinek  <jakub@redhat.com>

	PR c++/81258
	* parser.c (cp_parser_decomposition_declaration): Diagnose invalid
	forms of structured binding initializers.

	* g++.dg/cpp1z/decomp21.C (foo): Adjust expected diagnostics.
	* g++.dg/cpp1z/decomp30.C: New test.

From-SVN: r250286
2017-07-17 21:39:23 +02:00
Jason Merrill 239a30a97e PR c++/81204 - parse error with dependent template-name
PR c++/81204 - parse error with dependent template-name
	* parser.c (cp_parser_lookup_name): Revert previous change.

From-SVN: r250038
2017-07-06 14:27:05 -04:00
Jason Merrill a577c31243 PR c++/54769 - wrong lookup of dependent template-name.
PR c++/81257 - ICE with invalid ::template.
	* parser.c (cp_parser_template_name): Handle dependent object type.
	(cp_parser_nested_name_specifier_opt): Make template_keyword_p a
	parameter.
	(cp_parser_id_expression): Pass it.

From-SVN: r249857
2017-06-30 18:20:22 -04:00
Jason Merrill 7c9092dba9 PR c++/81180 - ICE with C++17 deduction of member class template.
* pt.c (build_deduction_guide): Correct member template handling.

From-SVN: r249817
2017-06-29 17:32:20 -04:00
Jason Merrill c98abc8fee PR c++/81188 - matching decltype of member function call.
* tree.c (cp_tree_equal): Remove COMPONENT_REF special case.

From-SVN: r249814
2017-06-29 15:44:58 -04:00
Jason Merrill 738a36a2c2 PR c++/81164 - ICE with invalid inherited constructor.
* search.c (binfo_direct_p): New.
	* name-lookup.c (do_class_using_decl): Use it.

From-SVN: r249801
2017-06-29 12:46:29 -04:00
Jason Merrill 35813cb651 PR c++/61022 - error with variadic template template parm
* pt.c (convert_template_argument): Keep the TYPE_PACK_EXPANSION.

From-SVN: r249763
2017-06-28 17:08:58 -04:00
Jason Merrill ae2daf1922 PR c++/72801 - ICE with variadic partial specialization
* pt.c (unify_pack_expansion): Use PACK_EXPANSION_EXTRA_ARGS.

From-SVN: r249762
2017-06-28 17:08:50 -04:00
Jason Merrill 98626a3eea PR c++/81204 - parse error with dependent template-name
* parser.c (cp_parser_lookup_name): Disqualify function templates
	after lookup.

From-SVN: r249761
2017-06-28 17:08:43 -04:00
Jason Merrill aa2978007a re PR c++/81215 (deduction failure with variadic template template parameter)
PR c++/81215

	* pt.c (unify_bound_ttp_args): Restore old logic for C++14 and down.

From-SVN: r249665
2017-06-26 14:49:25 -04:00
Jason Merrill 6eb22297df PR c++/79056 - C++17 ICE with invalid template syntax.
* parser.c (cp_parser_simple_type_specifier): Don't assume that type
	is a TYPE_DECL.
	(cp_parser_check_for_invalid_template_id): Handle TYPE_DECL.
	* pt.c (template_placeholder_p): New.
	* cp-tree.h: Declare it.

From-SVN: r249615
2017-06-23 19:30:01 -04:00
Jakub Jelinek 54a390bed7 re PR c++/81154 (OpenMP with shared variable in a template class crash)
PR c++/81154
	* semantics.c (handle_omp_array_sections_1, finish_omp_clauses):
	Complain about t not being a variable if t is OVERLOAD even
	when processing_template_decl.

	* g++.dg/gomp/pr81154.C: New test.

From-SVN: r249483
2017-06-22 00:22:05 +02:00