[llvm-bugs] [Bug 52297] New: interesting difference in do_get behavior between libc++ and other libraries.

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Oct 25 12:47:41 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=52297

            Bug ID: 52297
           Summary: interesting difference in do_get behavior between
                    libc++ and other libraries.
           Product: libc++
           Version: 11.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Standards Issues
          Assignee: unassignedclangbugs at nondot.org
          Reporter: edward.vogel at hpe.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Created attachment 25391
  --> https://bugs.llvm.org/attachment.cgi?id=25391&action=edit
Small program that shows the issue.

The attached small program shows a difference in the behavior of libc++ do_get
when a class overrides the standard do_get.   Here an overriding do_get for
bool types calls the base class do_get.   With libc++ that call will call the
long do_get viritual function in the overriding class.   Other libraries (gnu,
Visual Studio) will call the base class long do_get.

In reading the Standard, it's not clear to me who is correct.  This is why I've
posted this as a standards issue.

Here is a cut/paste from a Cygwin session:


VogelEd at XLB3502Q4E ~/temp
$ clang++ -o a.out t1.cpp

VogelEd at XLB3502Q4E ~/temp
$ ./a.out
In bool do_get
Returning from bool do_get

VogelEd at XLB3502Q4E ~/temp
$ clang++ -o a.out -stdlib=libc++ t1.cpp

VogelEd at XLB3502Q4E ~/temp
$ ./a.out
In bool do_get
In long do_get
Returning from long do_get
Returning from bool do_get


The attached reproducer is a greatly reduced and modified version of one of
the runtime library tests I use to test one of our HPE runtimes.

Probably not a big deal, but this difference in behavior could cause customer
confusion.

Thank you for your time,

Ed Vogel

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20211025/917d68d0/attachment.html>


More information about the llvm-bugs mailing list