llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

interesting difference in do_get behavior between libc++ and other libraries.

Open edfvogel opened this issue 5 years ago • 1 comments

Bugzilla Link 52297
Version 11.0
OS All
Attachments Small program that shows the issue.
CC @mclow

Extended Description

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@XLB3502Q4E ~/temp $ clang++ -o a.out t1.cpp

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

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

VogelEd@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

edfvogel avatar Oct 25 '21 19:10 edfvogel

LWG4163 is NAD now.

frederick-vs-ja avatar Feb 08 '25 01:02 frederick-vs-ja