[Bug c++/59821] New: __builtin_LINE and __builtin_FILE for new'd objects is wrong
joerg.richter@pdv-fs.de
gcc-bugzilla@gcc.gnu.org
Wed Jan 15 08:35:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59821
Bug ID: 59821
Summary: __builtin_LINE and __builtin_FILE for new'd objects is
wrong
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: joerg.richter@pdv-fs.de
The script below demonstrates that __builtin_LINE used in constructors
is different when the object is allocated with new. The same is true for
__builtin_FILE and I suspect also for __builtin_FUNCTION.
cat > t.cc <<EOF
#include <cassert>
struct Foo
{
int line;
Foo( int line = __builtin_LINE() )
: line( line )
{}
};
int main()
{
assert( Foo().line == (new Foo)->line );
}
EOF
g++ -o t t.cc
./t
More information about the Gcc-bugs
mailing list