[LLVMbugs] [Bug 24092] New: conversion from 'void ()' to 'const Option<void (*)()>' is ambiguous

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Sat Jul 11 08:42:13 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=24092

            Bug ID: 24092
           Summary: conversion from 'void ()' to 'const Option<void
                    (*)()>' is ambiguous
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: haosdent at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This code snippet could not compile with clang++3.5, but could compile with
clang++3.6 . And I search https://llvm.org/bugs/ , seems could not find any
bugs about this. So why this code snippet could not compile in clang++3.5? g++
don't have this problem. Thank you 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 with clang++3.5

test.cpp:25:13: error: conversion from 'void ()' to 'const Option<void (*)()>'
is 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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150711/59ba8193/attachment.html>


More information about the llvm-bugs mailing list