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: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to