This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH to be more helpful about noexcept/thread_local in C++98 mode


We end up in cp_parser_diagnose_invalid_type_name for uses of noexcept and thread_local as well as constexpr, and we can give the same helpful message.

Tested x86_64-pc-linux-gnu, applying to trunk.
commit df531541273db6a1f885f48f7a4923bfbc437999
Author: Jason Merrill <jason@redhat.com>
Date:   Wed Jun 4 13:29:01 2014 -0400

    	* parser.c (cp_parser_diagnose_invalid_type_name): Give helpful note
    	for noexcept and thread_local, too.

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 60e6cda..7d574d0 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -2920,6 +2920,13 @@ cp_parser_diagnose_invalid_type_name (cp_parser *parser,
       if (cxx_dialect < cxx11 && id == ridpointers[(int)RID_CONSTEXPR])
 	inform (location, "C++11 %<constexpr%> only available with "
 		"-std=c++11 or -std=gnu++11");
+      else if (cxx_dialect < cxx11 && id == ridpointers[(int)RID_NOEXCEPT])
+	inform (location, "C++11 %<noexcept%> only available with "
+		"-std=c++11 or -std=gnu++11");
+      else if (cxx_dialect < cxx11
+	       && !strcmp (IDENTIFIER_POINTER (id), "thread_local"))
+	inform (location, "C++11 %<thread_local%> only available with "
+		"-std=c++11 or -std=gnu++11");
       else if (processing_template_decl && current_class_type
 	       && TYPE_BINFO (current_class_type))
 	{

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]