aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-07-15 10:13:22 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-07-15 10:13:22 -0400
commit0467e3ebef7688c50fb0141b10c8b5e7e4dbbcdf (patch)
treea9d17a844b4ff1719c689b80372facf14dec2d2a /gcc/cp
parent49f88e433367feaed27d29528423bc9fb90a8f72 (diff)
downloadgcc-0467e3ebef7688c50fb0141b10c8b5e7e4dbbcdf.zip
gcc-0467e3ebef7688c50fb0141b10c8b5e7e4dbbcdf.tar.gz
gcc-0467e3ebef7688c50fb0141b10c8b5e7e4dbbcdf.tar.bz2
re PR c++/65091 (decltype(~arg) fails for template functions)
PR c++/65091 * parser.c (cp_parser_unqualified_id): Don't accept ~x in a template if there is no type x in scope. From-SVN: r225831
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c11
2 files changed, 15 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 00cbe47..6b92826 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2015-07-15 Jason Merrill <jason@redhat.com>
+
+ PR c++/65091
+ * parser.c (cp_parser_unqualified_id): Don't accept ~x in a
+ template if there is no type x in scope.
+
2015-07-14 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/66850
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 574ffba..f1d5656 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -5162,8 +5162,15 @@ cp_parser_unqualified_id (cp_parser* parser,
if (processing_template_decl
&& ! cp_parser_parse_definitely (parser))
{
- /* We couldn't find a type with this name, so just accept
- it and check for a match at instantiation time. */
+ /* We couldn't find a type with this name. If we're parsing
+ tentatively, fail and try something else. */
+ if (cp_parser_uncommitted_to_tentative_parse_p (parser))
+ {
+ cp_parser_simulate_error (parser);
+ return error_mark_node;
+ }
+ /* Otherwise, accept it and check for a match at instantiation
+ time. */
type_decl = cp_parser_identifier (parser);
if (type_decl != error_mark_node)
type_decl = build_nt (BIT_NOT_EXPR, type_decl);