This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/59821] New: __builtin_LINE and __builtin_FILE for new'd objects is wrong


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]