re PR c++/58072 ([C++11] Error messages involving user-defined literals are poor (refer to tokens))

gcc/c-family:

2013-08-04  Ed Smith-Rowland  <3dw4rd@verizon.net>

	PR c++/58072
	* c-common.c (c_parse_error): Catch user-defined literal tokens and
	provide useful error strings.


gcc/testsuite:

2013-08-04  Ed Smith-Rowland  <3dw4rd@verizon.net>

	PR c++/58072
	* g++.dg/cpp0x/pr58072.C: New.

From-SVN: r201475
This commit is contained in:
Ed Smith-Rowland 2013-08-04 19:11:21 +00:00 committed by Edward Smith-Rowland
parent 137a1a27e2
commit 65e5a578a8
4 changed files with 41 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2013-08-04 Ed Smith-Rowland <3dw4rd@verizon.net>
PR c++/58072
* c-common.c (c_parse_error): Catch user-defined literal tokens and
provide useful error strings.
2013-08-03 Gabriel Dos Reis <gdr@integrable-solutions.net>
* c-ada-spec.c (pp_ada_tree_identifier): Use specialized pretty

View File

@ -9352,6 +9352,18 @@ c_parse_error (const char *gmsgid, enum cpp_ttype token_type,
free (message);
message = NULL;
}
else if (token_type == CPP_CHAR_USERDEF
|| token_type == CPP_WCHAR_USERDEF
|| token_type == CPP_CHAR16_USERDEF
|| token_type == CPP_CHAR32_USERDEF)
message = catenate_messages (gmsgid,
" before user-defined character literal");
else if (token_type == CPP_STRING_USERDEF
|| token_type == CPP_WSTRING_USERDEF
|| token_type == CPP_STRING16_USERDEF
|| token_type == CPP_STRING32_USERDEF
|| token_type == CPP_UTF8STRING_USERDEF)
message = catenate_messages (gmsgid, " before user-defined string literal");
else if (token_type == CPP_STRING
|| token_type == CPP_WSTRING
|| token_type == CPP_STRING16

View File

@ -1,3 +1,8 @@
2013-08-04 Ed Smith-Rowland <3dw4rd@verizon.net>
PR c++/58072
* g++.dg/cpp0x/pr58072.C: New.
2013-08-03 Bill Schmidt <wschmidt@vnet.linux.ibm.com>
* gcc.dg/torture/pr57993-2.cpp: New.

View File

@ -0,0 +1,18 @@
// { dg-do compile }
// { dg-options "-std=c++11" }
// PR c++/58072
extern 'c'void*blah(void*); // { dg-error "expected unqualified-id before user-defined character literal" }
extern L'c'void*Lblah(void*); // { dg-error "expected unqualified-id before user-defined character literal" }
extern u'c'void*ublah(void*); // { dg-error "expected unqualified-id before user-defined character literal" }
extern U'c'void*Ublah(void*); // { dg-error "expected unqualified-id before user-defined character literal" }
extern "c"void*strblah(void*); // { dg-error "expected unqualified-id before user-defined string literal" }
extern L"c"void*Lstrblah(void*); // { dg-error "expected unqualified-id before user-defined string literal" }
extern u"c"void*ustrblah(void*); // { dg-error "expected unqualified-id before user-defined string literal" }
extern U"c"void*Ustrblah(void*); // { dg-error "expected unqualified-id before user-defined string literal" }
extern u8"c"void*u8strblah(void*); // { dg-error "expected unqualified-id before user-defined string literal" }
extern 123void*ULLblah(void*); // { dg-error "expected unqualified-id before numeric constant" }
extern 123.456void*Ldblblah(void*); // { dg-error "expected unqualified-id before numeric constant" }