[llvm-bugs] [Bug 41705] New: exception specification does not match error for extra parentheses (Derived from libstdc++ trunk)

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 2 02:32:32 PDT 2019


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: unassignedclangbugs at nondot.org
          Reporter: peter.smith at linaro.org
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190502/943c3bff/attachment.html>


More information about the llvm-bugs mailing list