1

E.g. the following will fail to compile:

auto foo = [](const char**) {};
char* ptr = nullptr;
foo(&ptr);

Visual studio says that there's a conversion that loses qualifiers. Clang says cannot initialize a parameter of type 'const char **' with an rvalue of type 'char **". Perhaps my brain just isn't working today, but why is this dis-allowed? char* can implicitly convert to const char* after all

Duncan
  • 980
  • 6
  • 17
  • https://stackoverflow.com/questions/19910296/how-to-convert-pointer-to-pointer-type-to-const – Mat Jun 01 '18 at 08:38

1 Answers1

0

Oh wait, yes my brain isn't working today. foo can assign a const char* to the pointer, which is clearly bad.

Duncan
  • 980
  • 6
  • 17