[LLVMbugs] [Bug 15042] New: Clang interprets exception spec as functional cast

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 22 09:32:46 PST 2013


             Bug #: 15042
           Summary: Clang interprets exception spec as functional cast
           Product: clang
           Version: 3.0
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: steveire at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ clang++ --version
Ubuntu clang version 3.0-6ubuntu3 (tags/RELEASE_30/final) (based on LLVM 3.0)
Target: x86_64-pc-linux-gnu
Thread model: posix

While attempting to implement a feature, I hit 
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56071 in g++, though that seems 
to work with clang, and I hit other bugs in clang, which work with g++.

With this code:

  class B
    template <typename T> friend struct A;
      B(int, char) {}
      ~B() {}

  template <typename T>
  struct A
      T t;
      template<typename... Args>
      A(Args&&... args) noexcept(noexcept(T(std::forward<Args>(args)...)))
        : t(std::forward<Args>(args)...)

  struct C {
    A<B> delegate;

    template<typename... Args>
    C(Args&&... args)
        : delegate(std::forward<Args>(args)...)
      { }


  int main() {
    A<B> ab(42, 'f'); // Works
    C c(42, 'f'); // Fails

    return 0;

I get this error with clang:

  other.cpp:59:41: error: no matching conversion for functional-style cast 
from 'const A<B>' to 'B'
    A(Args&&... args) noexcept(noexcept(T(std::forward<Args>(args)...)))

If I try using uniform-initialization instead, I get this:

  other.cpp:59:41: error: 'T' does not refer to a value
    A(Args&&... args) noexcept(noexcept(T{std::forward<Args>(args)...}))

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list