#define _GLIBCXX_CONCEPT_CHECKS
#include <regex>
void f() { std::regex r("hello"); }
When the above is compiled as C++11 in either GCC or Clang, an enormous template error is generated, the key part of which seems to be:
/opt/gcc-5.3.0/include/c++/5.3.0/bits/boost_concept_check.h:206:11: error: use of deleted function 'std::__detail::_StateSeq >& std::__detail::_StateSeq >::operator=(const std::__detail::_StateSeq >&)'
__a = __a; // require assignment operator
^
But taking a guess at what that means, I notice that std::regex does have an assignment operator.
Also, it is my understanding that enabling concepts ought not to change whether the code compiles. However, removing the #define makes it compile.
Two part question:
- Is this error, and its appearance only when concepts are enabled, correct behavior?
- If yes, how am I supposed to make a regex?
std::stringin the constructor rather than a string constant.