Functional style casts in exception specification

Hi there,

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;
  private:
      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)
        noexcept(noexcept(A<B>(std::forward<Args>(args)...)))
        : delegate(std::forward<Args>(args)...)
      { }
  };

  #endif

  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)...}))

Though that works fine in g++. Are these bugs in clang that I should file?
One bug report or two?

Any ideas of a workaround?

Thanks,

Steve.

Stephen Kelly wrote:

Though that works fine in g++. Are these bugs in clang that I should file?
One bug report or two?

I filed http://llvm.org/bugs/show_bug.cgi?id=15042

Thanks,

Steve.