]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/54526 (again)
authorPaolo Carlini <paolo.carlini@oracle.com>
Fri, 4 Jan 2013 15:30:24 +0000 (15:30 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Fri, 4 Jan 2013 15:30:24 +0000 (15:30 +0000)
/libcpp
2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/54526 (again)
* lex.c (_cpp_lex_direct): In C++11 mode, implement 2.5 p3, bullet 2.

/gcc/cp
2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/54526 (again)
* parser.c (cp_parser_template_id): Revert core of previous change
(keep adjusted inform message).

/gcc/testsuite
2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/54526 (again)
* g++.dg/cpp0x/parse2.C: Extend.
* g++.old-deja/g++.other/crash28.C: Adjust.

From-SVN: r194909

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/parse2.C
gcc/testsuite/g++.old-deja/g++.other/crash28.C
libcpp/ChangeLog
libcpp/lex.c

index 4b7968a23dc8b4107ac244e561806121cfaf4e29..0aef08d71265f5e3976419ff3d12a14742e8325c 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/54526 (again)
+       * parser.c (cp_parser_template_id): Revert core of previous change
+       (keep adjusted inform message).
+
 2013-01-03  Jason Merrill  <jason@redhat.com>
 
        PR c++/55419
index 3dc2ec6316a0d7b439d36c0a5d7034bdac70ef08..872d419867273faaa696c3fb63cc45d53d362499 100644 (file)
@@ -1,6 +1,6 @@
 /* C++ Parser.
    Copyright (C) 2000, 2001, 2002, 2003, 2004,
-   2005, 2007, 2008, 2009, 2010, 2011, 2012  Free Software Foundation, Inc.
+   2005, 2007-2013  Free Software Foundation, Inc.
    Written by Mark Mitchell <mark@codesourcery.com>.
 
    This file is part of GCC.
@@ -12655,11 +12655,9 @@ cp_parser_template_id (cp_parser *parser,
          return error_mark_node;
        }
       /* Otherwise, emit an error about the invalid digraph, but continue
-        parsing because we got our argument list.  In C++11 do not emit
-        any error, per 2.5/3.  */
-      if (cxx_dialect < cxx0x
-         && permerror (next_token->location,
-                       "%<<::%> cannot begin a template-argument list"))
+        parsing because we got our argument list.  */
+      if (permerror (next_token->location,
+                    "%<<::%> cannot begin a template-argument list"))
        {
          static bool hint = false;
          inform (next_token->location,
index 1ce0571a2b6d531bf160586f0c9bd50fa4b55d35..ceba87bd6ac1eb574097421666613a9b212ade36 100644 (file)
@@ -1,3 +1,9 @@
+2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/54526 (again)
+       * g++.dg/cpp0x/parse2.C: Extend.
+       * g++.old-deja/g++.other/crash28.C: Adjust.
+
 2013-01-04  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/55862
index eea6b41aa1706d3854bbb5c50894ddcdee701bca..77ea14a92a8c9f1c7fc75ca9ca4e3e8afdc68c63 100644 (file)
@@ -10,3 +10,6 @@ int main()
 {
   X<::A> x;
 }
+
+int a;
+bool b = 0<::a;
index 59f1e844eeab50be2d893ac43a7e35536d073943..c0f4bfa66e6c6de94fe03e49facb1c80aa2bd00c 100644 (file)
@@ -31,5 +31,5 @@ public:
 };
 void foo::x() throw(bar)
 {
-  if (!b) throw bar (static_cast<::N::X*>(this));      // { dg-error "lambda expressions|expected" } parse error
+  if (!b) throw bar (static_cast<::N::X*>(this));      // { dg-error "lambda expressions|expected|invalid" } parse error
 }
index 332efa3ab9d9ca170d9f17af94e6fceafbd00f6f..840bad343257389953db4b6b36993e8af39f9ee9 100644 (file)
@@ -1,3 +1,8 @@
+2013-01-04  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/54526 (again)
+       * lex.c (_cpp_lex_direct): In C++11 mode, implement 2.5 p3, bullet 2.
+
 2013-01-03  Marc Glisse  <marc.glisse@inria.fr>
 
        PR bootstrap/50177
index 23809bc4b0aafea79d5ccf645d0fe23da66198df..866bb1156f1dbfacb7fb7c649b2f3b22ac37c16a 100644 (file)
@@ -1,6 +1,6 @@
 /* CPP Library - lexical analysis.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010,
-   2011, 2012 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2007-2013
+   Free Software Foundation, Inc.
    Contributed by Per Bothner, 1994-95.
    Based on CCCP program by Paul Rubin, June 1986
    Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -2290,6 +2290,17 @@ _cpp_lex_direct (cpp_reader *pfile)
        {
          if (*buffer->cur == ':')
            {
+             /* C++11 [2.5/3 lex.pptoken], "Otherwise, if the next
+                three characters are <:: and the subsequent character
+                is neither : nor >, the < is treated as a preprocessor
+                token by itself".  */
+             if (CPP_OPTION (pfile, cplusplus)
+                 && (CPP_OPTION (pfile, lang) == CLK_CXX11
+                     || CPP_OPTION (pfile, lang) == CLK_GNUCXX11)
+                 && buffer->cur[1] == ':'
+                 && buffer->cur[2] != ':' && buffer->cur[2] != '>')
+               break;
+
              buffer->cur++;
              result->flags |= DIGRAPH;
              result->type = CPP_OPEN_SQUARE;