https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67225
Bug ID: 67225 Summary: [concepts] Expression constraint with a constrained result turns off access checking Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ville.voutilainen at gmail dot com CC: andrew.n.sutton at gmail dot com, eric.niebler at gmail dot com, jason at redhat dot com Target Milestone: --- Test, which compiles successfully but probably shouldn't: template <class T, class U> concept bool Same() { return true; } template <class T> struct WrapT {T t;}; template <class T> concept bool Destructible() { return requires(T t, const T ct, WrapT<T>& wt) { {wt.~WrapT()} noexcept; {&t} -> Same<T*>; // #1 //{&t} -> T*; // #2 }; } template <Destructible T> void f() {} struct Y {private: ~Y();}; int main() { f<Y>(); } If #1 is commented out, f<Y>() will correctly fail. Whether #2 is present doesn't matter. If the destructor of Y is deleted, the presence of #1 doesn't matter and f<Y>() is rejected.