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

            Bug ID: 41705
           Summary: exception specification does not match error for extra
                    parentheses (Derived from libstdc++ trunk)
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
          Assignee: unassignedclangb...@nondot.org
          Reporter: peter.sm...@linaro.org
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@metafoo.co.uk

I've derived this from trunk libstdc++ which as of r270650 with commit Use
_GLIBCXX_NOEXCEPT_IF for std::swap is now failing to compile with clang due to
a 
error: exception specification in declaration does not match previous
declaration
clash with type_traits.

It looks like the error is caused by an extra set of parentheses introduced by
the _GLIBCXX_NOEXCEPT_IF macro. I can reproduce with the stripped down example:

cat t.cpp

template <class T> struct Foo {
    enum { value = 0 };
};

template <> struct Foo<bool> {
    enum { value = 1 };
};

template <class T>
void f1(T a) noexcept(Foo<T>::value);

template <class T>
void f1(T a) noexcept((Foo<T>::value)) {}

clang -c t.cpp

t.cpp:14:6: error: exception specification in declaration does not match
      previous declaration
void f1(T a) noexcept((Foo<T>::value)) {}
     ^
t.cpp:11:6: note: previous declaration is here
void f1(T a) noexcept(Foo<T>::value);
     ^
The error doesn't seem to be provoked if I just use noexcept(true) and
noexcept((true)).

My knowledge of the C++ standard isn't good enough to know whether the extra
parentheses allow the compiler to error in this case as the expressions aren't
identical? 

I'm intending to raise a PR on libstdc++ to see if I can get the type_traits to
precisely match move.h.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to