Bug #98049 MySQL X DevAPI for PHP compile failure with old C++14-compatible Clang versions
Submitted: 22 Dec 2019 16:13 Modified: 26 Dec 2019 11:59
Reporter: Ryan Schmidt Email Updates:
Status: Unsupported Impact on me:
None 
Category:Connectors: mysqlnd ( PHP ) Severity:S3 (Non-critical)
Version:MySQL X DevAPI for PHP 8.0.18 OS:MacOS (10.11)
Assigned to: MySQL Verification Team CPU Architecture:x86

[22 Dec 2019 16:13] Ryan Schmidt
Description:
Hi, I hope this is the right place to report a bug in the MySQL X DevAPI extension for PHP available at https://pecl.php.net/package/mysql_xdevapi

It requires C++14, but it fails to compile with some old C++14-compatible versions of Clang, such as those included in Xcode 7.2.1 and 8.2.1 (the latest versions compatible with OS X 10.10 and 10.11, respectively).

Here is a full build log:

https://build.macports.org/builders/ports-10.11_x86_64-builder/builds/104573/steps/install...

But the relevant error is:

mysqlx_collection__modify.cc:343:26: error: default initialization of an object of const type 'const util::string_view' without a user-provided default constructor
        const util::string_view Empty_doc_path;
                                ^
                                              {}

This Stack Overflow post explains that this was originally forbidden by the C++ standard. Clang enforced this; gcc did not. Later, the C++ standard was relaxed to allow this, and Clang was later updated.

https://stackoverflow.com/questions/7411515/why-does-c-require-a-user-provided-default-con...

So... should this code be changed to respect the original restriction? Or should users be required to use a newer compiler that implements the revised standard?

How to repeat:
Compile on OS X 10.10 with clang from Xcode 6.3 or later up to 7.2.1, or on OS X 10.11 with clang from any supported Xcode version up to 8.2.1.

Suggested fix:
Possibly modify the code so it compiles on any C++14-compatible compiler.

And regardless of whether the code is changed, please document the compiler requirements, whatever they are, in the README; there's currently no mention even of requiring C++14 at all.
[26 Dec 2019 11:59] MySQL Verification Team
Hi,

Please file a bug here:
https://bugs.php.net/report.php?bug_type=Documentation+problem&manpage=book.mysql-xdevapi

kind regards