diff options
author | Jason Merrill <jason@redhat.com> | 2011-07-20 10:21:05 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-07-20 10:21:05 -0400 |
commit | 34429675140b34e3d1c9f4ccb1021d15cb92edb5 (patch) | |
tree | 9e56cc48852c32e97103a681ceb85db78262ad17 /gcc/testsuite | |
parent | ff3ac0f47166f4ef3c6a22623bfadba6e419dbb1 (diff) | |
download | gcc-34429675140b34e3d1c9f4ccb1021d15cb92edb5.zip gcc-34429675140b34e3d1c9f4ccb1021d15cb92edb5.tar.gz gcc-34429675140b34e3d1c9f4ccb1021d15cb92edb5.tar.bz2 |
PR c++/6709 (DR 743)
PR c++/6709 (DR 743)
PR c++/42603 (DR 950)
gcc/cp/
* parser.c (token_is_decltype, cp_lexer_next_token_is_decltype): New.
(cp_parser_nested_name_specifier_opt): Allow decltype.
(cp_parser_qualifying_entity): Likewise.
(cp_parser_decltype): Replace source tokens with CPP_DECLTYPE.
(cp_parser_simple_type_specifier): Handle decltype as scope.
(cp_parser_base_specifier): Allow decltype.
(cp_parser_base_clause): Don't crash on null base.
* parser.h (CPP_KEYWORD, CPP_TEMPLATE_ID): Move to c-common.h.
(CPP_NESTED_NAME_SPECIFIER, N_CP_TTYPES): Likewise.
gcc/c-family/
* c-common.h (CPP_KEYWORD, CPP_TEMPLATE_ID): Move from cp/parser.h.
(CPP_NESTED_NAME_SPECIFIER, N_CP_TTYPES): Likewise.
(CPP_DECLTYPE): New.
* c-common.c (c_parse_error): Handle CPP_DECLTYPE.
From-SVN: r176513
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/decltype21.C | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1e2bc1c..faa412b 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-07-19 Jason Merrill <jason@redhat.com> + + PR c++/6709 (DR 743) + PR c++/42603 (DR 950) + * g++.dg/cpp0x/decltype21.C: New. + 2011-07-20 Richard Guenther <rguenther@suse.de> PR middle-end/18908 diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype21.C b/gcc/testsuite/g++.dg/cpp0x/decltype21.C new file mode 100644 index 0000000..ee73bfb --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype21.C @@ -0,0 +1,18 @@ +// PR c++/6709 (DR 743) +// PR c++/42603 (DR 950) +// { dg-options -std=c++0x } + +template <class T> +T make(); + +struct p { typedef int t; }; +struct c : decltype(make<p>()) {}; + +decltype(make<p>())::t t; + +int f(); +decltype(f())::t t2; // { dg-error "not a class" } + +struct D: decltype(f()) { }; // { dg-error "not a class" } + +// { dg-prune-output "expected initializer" } |