Bug 15242 - function-like cast notation
Summary: function-like cast notation
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: 16106
  Show dependency treegraph
 
Reported: 2013-03-07 15:21 UTC by Tom Tromey
Modified: 2017-03-14 11:17 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Tromey 2013-03-07 15:21:04 UTC
C++ function-like casts are not implemented in the gdb
expression parser:

(gdb) set lang c++
(gdb) print double(7)
A syntax error in expression, near `7)'.
Comment 1 Martin Sebor 2017-03-13 23:07:02 UTC
This missing functionality causes trouble when evaluating GCC predefined macros like __DBL_MAX__.  For example, in GNU gdb (GDB) Fedora 7.12.1-47.fc25:

(gdb) p __DBL_MAX__
A syntax error in expression, near `1.79769313486231570815e+308L)'.
(gdb) info macro __DBL_MAX__
Defined at /ssd/src/gcc/79800/gcc/gimple-fold.c:0
-D__DBL_MAX__=double(1.79769313486231570815e+308L)
Comment 2 Pedro Alves 2017-03-14 11:17:54 UTC
We should obviously fix that, but I thought I'd mention the workaround for folks that come here after running into this:

 (gdb) macro define __DBL_MAX__ ((double)1.79769313486231570815e+308L)

I.e., redefine the macro to something that gdb understands.  Evaluating expressions that involve __DBL_MAX__ will now use GDB's definition instead of the originally compiled in one.