{"action":"opened","issue":{"url":"https://api.github.com/repos/cppformat/cppformat/issues/242","labels_url":"https://api.github.com/repos/cppformat/cppformat/issues/242/labels{/name}","comments_url":"https://api.github.com/repos/cppformat/cppformat/issues/242/comments","events_url":"https://api.github.com/repos/cppformat/cppformat/issues/242/events","html_url":"https://github.com/cppformat/cppformat/issues/242","id":120594330,"number":242,"title":"CenterAlign test failure","user":{"login":"dean0x7d","id":4831417,"avatar_url":"https://avatars.githubusercontent.com/u/4831417?v=3","gravatar_id":"","url":"https://api.github.com/users/dean0x7d","html_url":"https://github.com/dean0x7d","followers_url":"https://api.github.com/users/dean0x7d/followers","following_url":"https://api.github.com/users/dean0x7d/following{/other_user}","gists_url":"https://api.github.com/users/dean0x7d/gists{/gist_id}","starred_url":"https://api.github.com/users/dean0x7d/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dean0x7d/subscriptions","organizations_url":"https://api.github.com/users/dean0x7d/orgs","repos_url":"https://api.github.com/users/dean0x7d/repos","events_url":"https://api.github.com/users/dean0x7d/events{/privacy}","received_events_url":"https://api.github.com/users/dean0x7d/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-05T22:59:59Z","updated_at":"2015-12-05T22:59:59Z","closed_at":null,"body":"After checking out e7f4566dd4771ca790872b9ddc67165623103386, the `FormatterTest.CenterAlign` test fails on Apple Clang 7.0.0:\r\n```\r\n3: cppformat/test/format-test.cc:723: Failure\r\n3: Value of: format(\"{0:^6}\", -42.0)\r\n3:   Actual: \" ---  \"\r\n3: Expected: \" -42  \"\r\n3: cppformat/test/format-test.cc:724: Failure\r\n3: Value of: format(\"{0:^5}\", -42.0l)\r\n3:   Actual: \" --- \"\r\n3: Expected: \" -42 \"\r\n3: [  FAILED  ] FormatterTest.CenterAlign (0 ms)\r\n```\r\n\r\nI tracked down the bug to [this `std::uninitialized_copy`](https://github.com/cppformat/cppformat/blob/master/format.h#L2776): if I replace it with a regular `std::copy` the test passes.\r\n\r\nMy guess is that the compiler takes some liberties with because both the source and destination use the same base pointer and the memory is assumed to be uninitialized. This could cause future problems with  `std::uninitialized_*` functions, depending on the compiler.\r\n\r\nI think the `copy` and `fill` functions should be simple enough to just implement directly in cppformat, without the overhead of parsing either `<algorithm>` or `<memory>`, or the potential problems with the `std::uninitialized_*` functions.\r\n\r\n"}}