Commit 80aac5c8 by Jason Merrill Committed by Jason Merrill

Remove Concepts from -std=c++1z.

gcc/c-family/
	* c-opts.c (set_std_cxx1z): Don't enable concepts.
gcc/testsuite/
	* lib/g++-dg.exp (g++-dg-runtest): Handle "concepts" in std list.
	* lib/target-supports.exp (check_effective_target_concepts): New.
gcc/cp/
	* parser.c (cp_parser_diagnose_invalid_type_name): Give helpful
	diagnostic for use of "concept".
	(cp_parser_requires_clause_opt): And "requires".
	(cp_parser_type_parameter, cp_parser_late_return_type_opt)
	(cp_parser_explicit_template_declaration): Adjust.
	* Make-lang.in (check-c++-all): Add "concepts" to std list.

From-SVN: r234069
parent 1e546b68
2016-03-08 Jason Merrill <jason@redhat.com>
* c-opts.c (set_std_cxx1z): Don't enable concepts.
2016-03-04 David Malcolm <dmalcolm@redhat.com>
PR c/68187
......
......@@ -1566,8 +1566,6 @@ set_std_cxx1z (int iso)
/* C++11 includes the C99 standard library. */
flag_isoc94 = 1;
flag_isoc99 = 1;
/* Enable concepts by default. */
flag_concepts = 1;
flag_isoc11 = 1;
cxx_dialect = cxx1z;
lang_hooks.name = "GNU C++14"; /* Pretend C++14 till standarization. */
......
2016-03-08 Jason Merrill <jason@redhat.com>
* parser.c (cp_parser_diagnose_invalid_type_name): Give helpful
diagnostic for use of "concept".
(cp_parser_requires_clause_opt): And "requires".
(cp_parser_type_parameter, cp_parser_late_return_type_opt)
(cp_parser_explicit_template_declaration): Adjust.
* Make-lang.in (check-c++-all): Add "concepts" to std list.
P0036R0: Unary Folds and Empty Parameter Packs
* pt.c (expand_empty_fold): Remove special cases for *,+,&,|.
......
......@@ -152,7 +152,7 @@ check-c++1z:
# Run the testsuite in all standard conformance levels.
check-c++-all:
$(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --stds=98,11,14,1z" check-g++
$(MAKE) RUNTESTFLAGS="$(RUNTESTFLAGS) --stds=98,11,14,1z,concepts" check-g++
# Run the testsuite with garbage collection at every opportunity.
check-g++-strict-gc:
......
......@@ -3172,6 +3172,8 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser, tree id,
&& !strcmp (IDENTIFIER_POINTER (id), "thread_local"))
inform (location, "C++11 %<thread_local%> only available with "
"-std=c++11 or -std=gnu++11");
else if (!flag_concepts && id == ridpointers[(int)RID_CONCEPT])
inform (location, "%<concept%> only available with -fconcepts");
else if (processing_template_decl && current_class_type
&& TYPE_BINFO (current_class_type))
{
......@@ -14668,13 +14670,10 @@ cp_parser_type_parameter (cp_parser* parser, bool *is_parameter_pack)
cp_parser_require (parser, CPP_GREATER, RT_GREATER);
// If template requirements are present, parse them.
if (flag_concepts)
{
tree reqs = get_shorthand_constraints (current_template_parms);
if (tree r = cp_parser_requires_clause_opt (parser))
reqs = conjoin_constraints (reqs, make_predicate_constraint (r));
TEMPLATE_PARMS_CONSTRAINTS (current_template_parms) = reqs;
}
tree reqs = get_shorthand_constraints (current_template_parms);
if (tree r = cp_parser_requires_clause_opt (parser))
reqs = conjoin_constraints (reqs, make_predicate_constraint (r));
TEMPLATE_PARMS_CONSTRAINTS (current_template_parms) = reqs;
/* Look for the `class' or 'typename' keywords. */
cp_parser_type_parameter_key (parser);
......@@ -19745,6 +19744,8 @@ cp_parser_late_return_type_opt (cp_parser* parser, cp_declarator *declarator,
/* A late-specified return type is indicated by an initial '->'. */
if (token->type != CPP_DEREF
&& token->keyword != RID_REQUIRES
&& !(token->type == CPP_NAME
&& token->u.value == ridpointers[RID_REQUIRES])
&& !(declare_simd_p || cilk_simd_fn_vector_p || oacc_routine_p))
return NULL_TREE;
......@@ -24216,8 +24217,20 @@ cp_parser_requires_clause (cp_parser *parser)
static tree
cp_parser_requires_clause_opt (cp_parser *parser)
{
if (!cp_lexer_next_token_is_keyword (parser->lexer, RID_REQUIRES))
return NULL_TREE;
cp_token *tok = cp_lexer_peek_token (parser->lexer);
if (tok->keyword != RID_REQUIRES)
{
if (!flag_concepts && tok->type == CPP_NAME
&& tok->u.value == ridpointers[RID_REQUIRES])
{
error_at (cp_lexer_peek_token (parser->lexer)->location,
"%<requires%> only available with -fconcepts");
/* Parse and discard the requires-clause. */
cp_lexer_consume_token (parser->lexer);
cp_parser_requires_clause (parser);
}
return NULL_TREE;
}
cp_lexer_consume_token (parser->lexer);
return cp_parser_requires_clause (parser);
}
......@@ -25608,13 +25621,10 @@ cp_parser_explicit_template_declaration (cp_parser* parser, bool member_p)
cp_parser_skip_to_end_of_template_parameter_list (parser);
/* Manage template requirements */
if (flag_concepts)
{
tree reqs = get_shorthand_constraints (current_template_parms);
if (tree r = cp_parser_requires_clause_opt (parser))
reqs = conjoin_constraints (reqs, make_predicate_constraint (r));
TEMPLATE_PARMS_CONSTRAINTS (current_template_parms) = reqs;
}
tree reqs = get_shorthand_constraints (current_template_parms);
if (tree r = cp_parser_requires_clause_opt (parser))
reqs = conjoin_constraints (reqs, make_predicate_constraint (r));
TEMPLATE_PARMS_CONSTRAINTS (current_template_parms) = reqs;
cp_parser_template_declaration_after_parameters (parser, parameter_list,
member_p);
......@@ -2238,6 +2238,16 @@ return value even without this option. In all other cases, when
exhaustion is signalled by throwing @code{std::bad_alloc}. See also
@samp{new (nothrow)}.
@item -fconcepts
@opindex fconcepts
Enable support for the C++ Extensions for Concepts Technical
Specification, ISO 19217 (2015), which allows code like
@smallexample
template <class T> concept bool Addable = requires (T t) @{ t + t; @};
template <Addable T> T add (T a, T b) @{ return a + b; @}
@end smallexample
@item -fconstexpr-depth=@var{n}
@opindex fconstexpr-depth
Set the maximum nested evaluation depth for C++11 constexpr functions
......
2016-03-08 Jason Merrill <jason@redhat.com>
* lib/g++-dg.exp (g++-dg-runtest): Handle "concepts" in std list.
* lib/target-supports.exp (check_effective_target_concepts): New.
2016-03-08 Jakub Jelinek <jakub@redhat.com>
PR c++/70135
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template <class T1, class T2> class A { };
......
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
template <class...> class tuple {};
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool Class() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool Class() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool One() { return sizeof(T) >= 4; }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool One() { return sizeof(T) >= 4; }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
typedef concept int CINT; // { dg-error "'concept' cannot appear in a typedef declaration" }
......
// PR c++/67007
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
template <class U>
concept bool A =
......
// PR c++/67159
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
template <class T>
concept bool R = requires (T& t) {
......
// PR c++/66962
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
template <typename> struct remove_cv;
template <typename> struct is_reference;
......
// PR c++/66092
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
#include <type_traits>
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
// Check equivalence of short- and longhand declarations.
......
// { dg-do run }
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
// template<typename T>
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-do run }
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
#include <cassert>
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-do run }
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
#include <cassert>
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
#include <cassert>
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
struct A {
......
// { dg-do run }
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
#include <cassert>
#include <iostream>
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C1()
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C()
......
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
#ifndef __cpp_concepts
#error __cpp_concepts not defined
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool Tuple() { // { dg-error "multiple statements" }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept auto C1() { return 0; } // { dg-error "deduced return type" }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-do compile }
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
// Test that constraint satisfaction checks work even when
// processing template declarations.
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-do run }
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
#include <cassert>
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
// Check shorthand notation.
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
// Redefinition errors.
......
// { dg-do link }
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
// FIXME: What is this actually testing?
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool Class() { return __is_class(T); }
......
// { dg-do run }
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
#include <cassert>
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool Eq() { return requires(T t) { t == t; }; }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool Eq() { return requires(T t) { t == t; }; }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-do run }
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
#include <cassert>
#include <type_traits>
......
// PR c++/67240
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
int foo(int x)
{
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C() { return __is_class(T); }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C = __is_class(T);
......
// { dg-do run }
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
#include <cassert>
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename ... T>
concept bool C1 = true;
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename ... T>
concept bool C1 = true;
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T, typename U = int>
concept bool C()
......
// PR c++/67003
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
namespace X {
template<class>
......
// PR c++/66985
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template <template <class> class T>
concept bool _Valid = requires { typename T<int>; };
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
struct Base {
template<typename T>
......
// { dg-do run}
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
......
// { dg-do run}
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
#include <cassert>
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool Type() { return true; }
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
// Make sure that we check partial concept ids
// with variable concepts.
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
// Check that constraints don't break unconstrained partial
// specializations.
......
// PR c++/67084
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
template <class T>
constexpr bool p = false;
......
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
template <class T> struct A { };
template <class T> requires false struct A<T*> { };
......
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
template <class T> concept bool is_int = __is_same_as(T,int);
......
// PR c++/67138
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
template <class T>
concept bool _Auto = true;
......
// PR c++/67152
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
template <class T>
concept bool HasType = requires { typename T::type; };
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T, typename U>
struct is_same
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
// Check argument deduction constraints.
// TODO: We shoul have more of these...
......
// PR c++/66218
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template <class T, class U>
concept bool Same = __is_same_as(T, U);
......
// PR c++/66218
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template <class T, class U>
concept bool Same = __is_same_as(T, U);
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template <class T, class U>
concept bool Same = __is_same_as(T, U);
......
// { dg-options -std=c++1z }
// { dg-options "-std=c++1z -fconcepts" }
template <int I> struct B { static const int i = I; };
template <int I> concept bool Few = I < 10;
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool Concept() {
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C = false;
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C1() {
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
using TD = int;
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C()
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
// Performance test... This should be fast.
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
// Handle alias templates in type requirements.
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool C1()
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<class T> concept bool C1 = true;
template<class A, class B> struct Pair {};
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template <class>
concept bool C1 () {
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template <typename, typename>
struct is_same {
......
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
void f1(int a) requires true; // OK
auto f2(int a) -> bool requires true; // OK
......
// { dg-do compile }
// { dg-options "-std=c++1z" }
// { dg-options "-std=c++1z -fconcepts" }
template<typename T>
concept bool Class () { return __is_class(T); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment