Bug #66803 Allow compilation using Clang in C++11 mode
Submitted: 13 Sep 2012 11:28 Modified: 2 Dec 2013 17:56
Reporter: Michael Gmelin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.5.27 OS:Any
Assigned to: CPU Architecture:Any
Tags: C++11, Clang, Contribution, libc++
Triage: Needs Triage: D3 (Medium)

[13 Sep 2012 11:28] Michael Gmelin
Description:
Those patches add static_cast<int>(...) in various places, since the
implicit type conversation from size_t (return value of my_offsetof)
to int (member offset of struct File_option) is not allowed anymore
when using clang++ -std=c++11.

See also:
http://www.freebsd.org/cgi/query-pr.cgi?pr=171546

How to repeat:
Compile mysql server using "clang++ -std=c++11" or "clang++ -std=c++11 -stdlib=libc++". Gcc is a little bit more forgiving, so compiling using "gcc47 -std=c++11" will work, but emit a couple of ugly warnings.

Suggested fix:
Apply the patches that will allow compilation but adding static_casts like described above.
[13 Sep 2012 11:33] Michael Gmelin
Patch to allow compilation with clang in C++11 mode

Attachment: mysql_server_clang.patch (application/octet-stream, text), 4.43 KiB.

[14 Sep 2012 22:19] Sveta Smirnova
Thank you for the report.

Verified as described.
[2 Dec 2013 17:56] Paul Dubois
Noted in 5.7.4 changelog.

Compilation problems were fixed for errors reported by Clang and gcc
when compiling in C++11 mode.
[31 Mar 2014 14:02] Paul Dubois
Noted in 5.6.18 changelog.
[2 Jun 2014 14:00] Laurynas Biveinis
$ bzr log -r 5874
------------------------------------------------------------
revno: 5874
committer: Jon Olav Hauglid <jon.hauglid@oracle.com>
branch nick: mysql-5.6-test
timestamp: Mon 2014-03-31 15:09:59 +0200
message:
  Backport from mysql-trunk to mysql-5.6 of:
  ------------------------------------------------------------
  revno: 7033
  committer: Jon Olav Hauglid <jon.hauglid@oracle.com>
  branch nick: mysql-trunk-c11
  timestamp: Wed 2013-11-27 13:54:59 +0100
  message:
    Bug#14631159: ALLOW COMPILATION USING CLANG IN C++11 MODE
    
    This patch fixes the new compilation errors that are reported by Clang and GCC
    when compiling in C++11 mode. 
    
    The patch is not based on the contribution in the bug report.