mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-04-10 12:31:04 +08:00
Use cxx_printable_name for __PRETTY_FUNCTION__ in cp_fname_init.
2019-09-02 Martin Liska <mliska@suse.cz> PR c++/91155 * c-common.c (fname_as_string): Use cxx_printable_name for __PRETTY_FUNCTION__ same as was used before r265711. 2019-09-02 Martin Liska <mliska@suse.cz> PR c++/91155 * g++.dg/torture/pr91155.C: New test. From-SVN: r275292
This commit is contained in:
parent
9297e01329
commit
ae0d3f6a59
@ -1,3 +1,9 @@
|
||||
2019-09-02 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR c++/91155
|
||||
* c-common.c (fname_as_string): Use cxx_printable_name for
|
||||
__PRETTY_FUNCTION__ same as was used before r265711.
|
||||
|
||||
2019-08-28 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
Implement P1152R4: Deprecating some uses of volatile.
|
||||
|
@ -4511,13 +4511,27 @@ cp_fname_init (const char* name, tree *type_p)
|
||||
static tree
|
||||
cp_make_fname_decl (location_t loc, tree id, int type_dep)
|
||||
{
|
||||
const char *const name = (type_dep && in_template_function ()
|
||||
? NULL : fname_as_string (type_dep));
|
||||
const char * name = NULL;
|
||||
bool release_name = false;
|
||||
if (!(type_dep && in_template_function ()))
|
||||
{
|
||||
if (current_function_decl == NULL_TREE)
|
||||
name = "top level";
|
||||
else if (type_dep == 1) /* __PRETTY_FUNCTION__ */
|
||||
name = cxx_printable_name (current_function_decl, 2);
|
||||
else if (type_dep == 0) /* __FUNCTION__ */
|
||||
{
|
||||
name = fname_as_string (type_dep);
|
||||
release_name = true;
|
||||
}
|
||||
else
|
||||
gcc_unreachable ();
|
||||
}
|
||||
tree type;
|
||||
tree init = cp_fname_init (name, &type);
|
||||
tree decl = build_decl (loc, VAR_DECL, id, type);
|
||||
|
||||
if (name)
|
||||
if (release_name)
|
||||
free (CONST_CAST (char *, name));
|
||||
|
||||
/* As we're using pushdecl_with_scope, we must set the context. */
|
||||
|
@ -1,3 +1,8 @@
|
||||
2019-09-02 Martin Liska <mliska@suse.cz>
|
||||
|
||||
PR c++/91155
|
||||
* g++.dg/torture/pr91155.C: New test.
|
||||
|
||||
2019-09-01 Marek Polacek <polacek@redhat.com>
|
||||
|
||||
PR c++/91129 - wrong error with binary op in template argument.
|
||||
|
18
gcc/testsuite/g++.dg/torture/pr91155.C
Normal file
18
gcc/testsuite/g++.dg/torture/pr91155.C
Normal file
@ -0,0 +1,18 @@
|
||||
/* PR c++/91155. */
|
||||
|
||||
template< char C > struct dummy {};
|
||||
|
||||
template< typename T > const char *test()
|
||||
{
|
||||
__builtin_printf ("test: %s\n", __PRETTY_FUNCTION__);
|
||||
return __PRETTY_FUNCTION__;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
if (__builtin_strcmp ("const char* test() [with T = dummy<\'\\000\'>]", test< dummy< '\0' > > ()) != 0)
|
||||
{};// __builtin_abort ();
|
||||
if (__builtin_strcmp ("const char* test() [with T = dummy<\'\\\'\'>]", test< dummy< '\'' > > ()) != 0)
|
||||
{};// __builtin_abort ();
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user