[MDEV-15068] sql/item_jsonfunc.cc doesn't compile on Solaris Created: 2018-01-25  Updated: 2018-01-27

Status: Open
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: 10.2.12
Fix Version/s: 10.2

Type: Bug Priority: Major
Reporter: Rainer Orth Assignee: Vicențiu Ciorbaru
Resolution: Unresolved Votes: 0
Labels: contribution
Environment:

Solaris 11.4 Beta with bundled gcc 5.5


Attachments: File ij.patch    

 Description   

When I tried to compile MariaDB 10.2.12 on Solaris 11.4 Beta (though I'm pretty certain
the same problem exists at least on Solaris 11 if not on 10), sql/item_jsonfunc.cc fails to
compile like this:

/vol/src/mariadb/mariadb-10.2.12/sql/item_jsonfunc.cc:2937:65: error: call of overloaded ‘sqrt(int)’ is ambiguous
 static const uint SQR_MAX_BLOB_WIDTH= (uint) sqrt(MAX_BLOB_WIDTH);
                                                                 ^
In file included from /usr/include/math.h:17:0,
                 from /vol/src/mariadb/mariadb-10.2.12/include/my_global.h:332,
                 from /vol/src/mariadb/mariadb-10.2.12/sql/item_jsonfunc.cc:17:
/usr/include/iso/math_iso.h:203:21: note: candidate: long double std::sqrt(long double)
  inline long double sqrt(long double __X) { return __sqrtl(__X); }
                     ^
/usr/include/iso/math_iso.h:171:15: note: candidate: float std::sqrt(float)
  inline float sqrt(float __X) { return __sqrtf(__X); }
               ^
/usr/include/iso/math_iso.h:65:15: note: candidate: double std::sqrt(double)
 extern double sqrt __P((double));
               ^

The attached patch fixes this by casting the sqrt arg to double to disambiguate.


Generated at Thu Feb 08 08:18:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.