kyamagu / matlab-sqlite3-driver

Matlab driver for SQLite3 database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

std regex in gcc4.8 not working

kukuruza opened this issue · comments

I had a problem with std::regex. I built the project on Ubuntu with gcc4.8, but when I run test/test_sqlite3.m, the 3rd test fails:

PASS: test_functional_1
PASS: test_functional_2
FAIL: test_functional_3
Unexpected Standard exception from MEX file.
What() is:regex_error
..

Error in sqlite3.execute (line 22)
    results = libsqlite3_('execute', varargin{1}, varargin(2:end));

Error in test_sqlite3>test_functional_3 (line 71)
  record = sqlite3.execute('SELECT * FROM records');

Error in test_sqlite3 (line 7)
      tests{i}();

I saw that you switched to std::regex for gcc4.8 -- the following snippet is from src/sqlite3mex.cc

#if !_MSC_VER && !__clang__ && (__GNUC__ < 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ < 8)))
#include <boost/regex.hpp>
using boost::regex;
using boost::regex_replace;
#else
#include <regex>
#endif

I recompiled the project using <boost/regex.hpp> by removing the #if, and it works. All tests pass in this case.

System: Ubuntu 14.04, gcc4.8.4, boost 1.55, Matlab 2015a

@kukuruza Thanks, this is due to the buggy regex implementation in gcc. Included a workaround in the latest commit.