gcc - Why clang++3.5 failed to compile this code snippet while clang++3.6 could compile it? -
this code snippet not compile clang++3.5, compile clang++3.6 . , search https://llvm.org/bugs/ , seems not find bugs this. why code snippet not compile in clang++3.5? g++ don't have problem. thank in advance.
void f() {} template <typename t> class option { public: option(const t &) {} option(t &&) {} template <typename u> option(const u &) {} }; class fork { public: fork(const option<void (*)(void)>&) {} }; int main() { fork fork(f); } the compile error clang++3.5
test.cpp:25:13: error: conversion 'void ()' 'const option<void (*)()>' ambiguous fork fork(f); ^ test.cpp:7:3: note: candidate constructor option(const t &) {} ^ test.cpp:9:3: note: candidate constructor option(t &&) {} ^ test.cpp:12:3: note: candidate constructor [with u = void ()] option(const u &) {} ^ 1 error generated. my clang++ version
clang++ --version apple llvm version 6.0 (clang-600.0.54) (based on llvm 3.5svn) target: x86_64-apple-darwin14.1.0 thread model: posix
it clang++ 3.5 compiler did not recognize constructors in option matched type void (). may have been caused const option<void (*)()> being ambiguous.
another site may find helpful: llvm open source lib
ps: post comment, i'm not @ 50 rep.
Comments
Post a Comment