[Bug libstdc++/83134] New: std::negation uses !B::value instead of !bool(B::value)

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 23 19:44:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83134

            Bug ID: 83134
           Summary: std::negation uses !B::value instead of
                    !bool(B::value)
           Product: gcc
           Version: 7.2.1
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#include <type_traits>

struct X {
  constexpr operator bool() const { return false; }
  constexpr bool operator!() const = delete;
};

struct Y {
  static constexpr X value{};
};

int main() {
  static_assert(std::negation<Y>::value);  
}

In file included from neg.cc:1:0:
/home/jwakely/gcc/8/include/c++/8.0.0/type_traits: In instantiation of ‘struct
std::__not_<Y>’:
/home/jwakely/gcc/8/include/c++/8.0.0/type_traits:172:12:   required from
‘struct std::negation<Y>’
neg.cc:13:33:   required from here
/home/jwakely/gcc/8/include/c++/8.0.0/type_traits:154:38: error: use of deleted
function ‘constexpr bool X::operator!() const’
     : public integral_constant<bool, !_Pp::value>
                                      ^~~~
neg.cc:5:18: note: declared here
   constexpr bool operator!() const = delete;
                  ^~~~~~~~
neg.cc: In function ‘int main()’:
neg.cc:13:35: error: ‘value’ is not a member of ‘std::negation<Y>’
   static_assert(std::negation<Y>::value);
                                   ^~~~~


More information about the Gcc-bugs mailing list