public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/17098] New: In program using unique_ptr, identifier 'tuple' cannot be used (problem with variadic templates?)
@ 2014-06-28 10:17 Marc.van-Leeuwen at math dot univ-poitiers.fr
2023-12-27 13:10 ` [Bug c++/17098] " ssbssa at sourceware dot org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Marc.van-Leeuwen at math dot univ-poitiers.fr @ 2014-06-28 10:17 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17098
Bug ID: 17098
Summary: In program using unique_ptr, identifier 'tuple' cannot
be used (problem with variadic templates?)
Product: gdb
Version: unknown
Status: NEW
Severity: normal
Priority: P2
Component: c++
Assignee: unassigned at sourceware dot org
Reporter: Marc.van-Leeuwen at math dot univ-poitiers.fr
Created attachment 7662
--> https://sourceware.org/bugzilla/attachment.cgi?id=7662&action=edit
preprocessed input from sample program, file mini.ii
When running gdb on a program using an instance of the unique_ptr class
template, the identifier 'tuple' can no longer be accessed in any way, as
otherwise valid expressions now give a syntax error. A minimal example:
mini.cpp:
#include <memory>
int main()
{
std::unique_ptr<int> p;
}
compile this with gcc (version 4.8.1) using the command
g++ -std=c++11 -ggdb -o mini mini.cpp
now run gdb and ask to print the (nonexistent) variable 'tuple'
$ gdb mini
GNU gdb (GDB) 7.6.1-ubuntu
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/license/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/marc/atlas/sources/stand-alone/mini...done.
(gdb) p tuple
A syntax error in expression, near `'.
(gdb)
Whereas in a program not using any unique_ptr (for instance the above program
after removing the unique statement in 'main') one would correctly get
(gdb) p tuple
No symbol "tuple" in current context.
It seems that 'tuple' has changed its syntax category for gdb, making any
access to variables/fields called 'tuple' impossible. I stumbled on this when
debugging a program that actually used a field of that name, but the bug does
not appear to depend on that circumstance.
Looking and the (attached) preprocessed input, it seems that the problem might
be that 'tuple' is defined as a variadic template class:
template<typename...>
class tuple;
and later
template<typename... _Elements>
class tuple : public _Tuple_impl<0, _Elements...>
{ ... };
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/17098] In program using unique_ptr, identifier 'tuple' cannot be used (problem with variadic templates?)
2014-06-28 10:17 [Bug c++/17098] New: In program using unique_ptr, identifier 'tuple' cannot be used (problem with variadic templates?) Marc.van-Leeuwen at math dot univ-poitiers.fr
@ 2023-12-27 13:10 ` ssbssa at sourceware dot org
2023-12-27 13:29 ` ssbssa at sourceware dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: ssbssa at sourceware dot org @ 2023-12-27 13:10 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17098
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |psmith at gnu dot org
--- Comment #2 from Hannes Domani <ssbssa at sourceware dot org> ---
*** Bug 22231 has been marked as a duplicate of this bug. ***
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/17098] In program using unique_ptr, identifier 'tuple' cannot be used (problem with variadic templates?)
2014-06-28 10:17 [Bug c++/17098] New: In program using unique_ptr, identifier 'tuple' cannot be used (problem with variadic templates?) Marc.van-Leeuwen at math dot univ-poitiers.fr
2023-12-27 13:10 ` [Bug c++/17098] " ssbssa at sourceware dot org
@ 2023-12-27 13:29 ` ssbssa at sourceware dot org
2023-12-27 16:52 ` tromey at sourceware dot org
2023-12-27 17:53 ` ssbssa at sourceware dot org
3 siblings, 0 replies; 5+ messages in thread
From: ssbssa at sourceware dot org @ 2023-12-27 13:29 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17098
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/17098] In program using unique_ptr, identifier 'tuple' cannot be used (problem with variadic templates?)
2014-06-28 10:17 [Bug c++/17098] New: In program using unique_ptr, identifier 'tuple' cannot be used (problem with variadic templates?) Marc.van-Leeuwen at math dot univ-poitiers.fr
2023-12-27 13:10 ` [Bug c++/17098] " ssbssa at sourceware dot org
2023-12-27 13:29 ` ssbssa at sourceware dot org
@ 2023-12-27 16:52 ` tromey at sourceware dot org
2023-12-27 17:53 ` ssbssa at sourceware dot org
3 siblings, 0 replies; 5+ messages in thread
From: tromey at sourceware dot org @ 2023-12-27 16:52 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17098
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
--- Comment #3 from Tom Tromey <tromey at sourceware dot org> ---
Maybe the canonical bug for this is bug#17272?
There are also several bugs open about exposing this to the Python API.
The fix seems to be stalled.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/17098] In program using unique_ptr, identifier 'tuple' cannot be used (problem with variadic templates?)
2014-06-28 10:17 [Bug c++/17098] New: In program using unique_ptr, identifier 'tuple' cannot be used (problem with variadic templates?) Marc.van-Leeuwen at math dot univ-poitiers.fr
` (2 preceding siblings ...)
2023-12-27 16:52 ` tromey at sourceware dot org
@ 2023-12-27 17:53 ` ssbssa at sourceware dot org
3 siblings, 0 replies; 5+ messages in thread
From: ssbssa at sourceware dot org @ 2023-12-27 17:53 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=17098
--- Comment #4 from Hannes Domani <ssbssa at sourceware dot org> ---
(In reply to Tom Tromey from comment #3)
> Maybe the canonical bug for this is bug#17272?
> There are also several bugs open about exposing this to the Python API.
> The fix seems to be stalled.
As I understand it, the problem here is about tuple being also the name of
the include file, and that's why you get a syntax error.
And according to c-exp.y, this behavior is intentional:
```
/* If we found a field on the "this" object, or we are looking
up a field on a struct, then we want to prefer it over a
filename. However, if the name was quoted, then it is better
to check for a filename or a block, since this is the only
way the user has of requiring the extension to be used. */
```
So if no variable is found by the name, but one of the files has that name,
it assumes the file is meant.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-12-27 17:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-28 10:17 [Bug c++/17098] New: In program using unique_ptr, identifier 'tuple' cannot be used (problem with variadic templates?) Marc.van-Leeuwen at math dot univ-poitiers.fr
2023-12-27 13:10 ` [Bug c++/17098] " ssbssa at sourceware dot org
2023-12-27 13:29 ` ssbssa at sourceware dot org
2023-12-27 16:52 ` tromey at sourceware dot org
2023-12-27 17:53 ` ssbssa at sourceware dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).