This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/59821] New: __builtin_LINE and __builtin_FILE for new'd objects is wrong
- From: "joerg dot richter at pdv-fs dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 15 Jan 2014 08:35:20 +0000
- Subject: [Bug c++/59821] New: __builtin_LINE and __builtin_FILE for new'd objects is wrong
- Auto-submitted: auto-generated
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