VBA takes wrong branch at If-statement – severe compiler bug?

This bug is not present on 32-bit, but it seems to be present in 64-bit VBA-capable applications (I’ve tried Excel, Word, and AutoCAD). Since the question already covers what happens if the Object does not get terminated or if there is no Class_Terminate event, the following examples all use an Object that will surely go … Read more

Double free in the C++ standard library using only std::function and std::shared_pointer

I believe the relevant part of the standard is [res.on.objects], which states If an object of a standard library type is accessed, and the beginning of the object’s lifetime does not happen before the access, or the access does not happen before the end of the object’s lifetime, the behavior is undefined unless otherwise specified. … Read more

Why do gcc and clang each produce different output for this program? (conversion operator vs constructor)

I believe clang’s result is correct. In both bar_t a { foo } direct-list-initialization and in a static_cast between user defined types, constructors of the destination type are considered before user defined conversion operators on the source type (C++14 [dcl.init.list]/3 [expr.static.cast]/4). If overload resolution finds a suitable constructor then it’s used. When doing overload resolution … Read more

‘const float’ value different than ‘float’ when casting to ‘int’ in C#

The “Why” of this will basically boil down to the fact that frequently, when working with float data, an internal representation may be used that has more precision than is specified for float or double. This is explicitly catered for in the Virtual Execution System (VES) Spec (section 12 of Partition I): floating-point numbers are … Read more

Constexpr if with a non-bool condition

Clang is diagnosing under these paragraphs [stmt.if] (emphasis mine) 2 If the if statement is of the form if constexpr, the value of the condition shall be a contextually converted constant expression of type bool; this form is called a constexpr if statement. [expr.const] 4 A converted constant expression of type T is an expression, … Read more

‘Delegate ‘System.Action’ does not take 0 arguments.’ Is this a C# compiler bug (lambdas + two projects)?

FINAL UPDATE: The bug has been fixed in C# 5. Apologies again for the inconvenience, and thanks for the report. Original analysis: I can reproduce the problem with the command-line compiler. It certainly looks like a bug. It’s probably my fault; sorry about that. (I wrote all of the lambda-to-delegate conversion checking code.) I’m in … Read more

Unexpected result when C++ store element into std::vector from return value of function

The behaviour is undefined in all C++ versions before C++17. The simple reason is that the two sides of the assignment operator can be evaluated in any order: Assuming A[1] is evaluated first, you get an int& referring to the second element of A at that point. Then, the func() is evaluated, which can reallocate … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)