mirror of git://gcc.gnu.org/git/gcc.git
re PR c++/64105 (ICE: in strip_typedefs, at cp/tree.c:1326)
PR c++/64105 * parser.c (cp_parser_simple_type_specifier): Make auto parameter before -std=c++14 an error. From-SVN: r218879
This commit is contained in:
parent
18d27358a5
commit
90f6debee4
|
|
@ -1,5 +1,9 @@
|
||||||
2014-12-18 Jason Merrill <jason@redhat.com>
|
2014-12-18 Jason Merrill <jason@redhat.com>
|
||||||
|
|
||||||
|
PR c++/64105
|
||||||
|
* parser.c (cp_parser_simple_type_specifier): Make auto parameter
|
||||||
|
before -std=c++14 an error.
|
||||||
|
|
||||||
PR c++/64352
|
PR c++/64352
|
||||||
* pt.c (tsubst_copy_and_build): Pass complain to mark_used.
|
* pt.c (tsubst_copy_and_build): Pass complain to mark_used.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14862,23 +14862,26 @@ cp_parser_simple_type_specifier (cp_parser* parser,
|
||||||
maybe_warn_cpp0x (CPP0X_AUTO);
|
maybe_warn_cpp0x (CPP0X_AUTO);
|
||||||
if (parser->auto_is_implicit_function_template_parm_p)
|
if (parser->auto_is_implicit_function_template_parm_p)
|
||||||
{
|
{
|
||||||
|
if (cxx_dialect >= cxx14)
|
||||||
type = synthesize_implicit_template_parm (parser);
|
type = synthesize_implicit_template_parm (parser);
|
||||||
|
else
|
||||||
|
type = error_mark_node;
|
||||||
|
|
||||||
if (current_class_type && LAMBDA_TYPE_P (current_class_type))
|
if (current_class_type && LAMBDA_TYPE_P (current_class_type))
|
||||||
{
|
{
|
||||||
if (cxx_dialect < cxx14)
|
if (cxx_dialect < cxx14)
|
||||||
pedwarn (location_of (type), 0,
|
error_at (token->location,
|
||||||
"use of %<auto%> in lambda parameter declaration "
|
"use of %<auto%> in lambda parameter declaration "
|
||||||
"only available with "
|
"only available with "
|
||||||
"-std=c++14 or -std=gnu++14");
|
"-std=c++14 or -std=gnu++14");
|
||||||
}
|
}
|
||||||
else if (cxx_dialect < cxx14)
|
else if (cxx_dialect < cxx14)
|
||||||
pedwarn (location_of (type), 0,
|
error_at (token->location,
|
||||||
"use of %<auto%> in parameter declaration "
|
"use of %<auto%> in parameter declaration "
|
||||||
"only available with "
|
"only available with "
|
||||||
"-std=c++14 or -std=gnu++14");
|
"-std=c++14 or -std=gnu++14");
|
||||||
else
|
else
|
||||||
pedwarn (location_of (type), OPT_Wpedantic,
|
pedwarn (token->location, OPT_Wpedantic,
|
||||||
"ISO C++ forbids use of %<auto%> in parameter "
|
"ISO C++ forbids use of %<auto%> in parameter "
|
||||||
"declaration");
|
"declaration");
|
||||||
}
|
}
|
||||||
|
|
@ -14971,6 +14974,9 @@ cp_parser_simple_type_specifier (cp_parser* parser,
|
||||||
/* Consume the token. */
|
/* Consume the token. */
|
||||||
cp_lexer_consume_token (parser->lexer);
|
cp_lexer_consume_token (parser->lexer);
|
||||||
|
|
||||||
|
if (type == error_mark_node)
|
||||||
|
return error_mark_node;
|
||||||
|
|
||||||
/* There is no valid C++ program where a non-template type is
|
/* There is no valid C++ program where a non-template type is
|
||||||
followed by a "<". That usually indicates that the user thought
|
followed by a "<". That usually indicates that the user thought
|
||||||
that the type was a template. */
|
that the type was a template. */
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
// PR c++/64105
|
||||||
|
// This test was ICEing on pre-C++14 mode.
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
using F = std::function<void(void)>;
|
||||||
|
|
||||||
|
struct X
|
||||||
|
{
|
||||||
|
template <typename T>
|
||||||
|
static void f(T t)
|
||||||
|
{
|
||||||
|
g(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void g(F) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
X::f([](auto... xs){}); // { dg-error "" "" { target { ! cxx14 } } }
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue