CaseyCarter/cmcstl2

GCC PR 67225: Concepts break access control

Opened this issue · 3 comments

Gcc silently bugs when appears a declaration involving a placeholder that is a partial concept specialization as in:

template<Sentinel<I> T>
void foo();

After having read such a declaration, gcc does not perfom any more any access violation check. This simple piece of code should not compile:

#include <stl2/algorithm.hpp>
class a_class
   {
   void f() {}//private
   };
int main()
  {
  a_class{}.f();//access private member, accepted by gcc
  }

Their are maybe much more silent failures caused by this bug.

You can reproduce test this gcc bug with this peace of code. The bug exist since gcc6.1. gcc7.1.1 is still bugged.

template<class ,class >
concept bool Same = false;
template<class T>
concept bool Other = requires(T a)
  {
  {a + a} -> Same<T>;
  };
class A
  {
  void f(){};
  };

int main()
{
A{}.f(); //private member access accepted
}

I think this is another instance of GCC PR 78715, but I'll keep this issue open until the bug is resolved so I can make sure.

I had post this bug GCC PR 80962. I do not know haw bug report can be merged.

Now I think the issue is broader. This gcc buggy behavior can also happens if a concept appears in a if constexpr.

I think this is another instance of GCC PR 78715, but I'll keep this issue open until the bug is resolved so I can make sure.

Which is a duplicate of GCC PR 67225.