This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/87017] New: vector must have the same value as its allocator
- From: "development at faf-ltd dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 19 Aug 2018 22:04:52 +0000
- Subject: [Bug c++/87017] New: vector must have the same value as its allocator
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87017
Bug ID: 87017
Summary: vector must have the same value as its allocator
Product: gcc
Version: 8.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: development@faf-ltd.com
Target Milestone: ---
This MCVE compiles/runs with gcc 7.3, clang 6.0 and icc 18.0 [this is, what I
tested so far]:
#include <regex>
#include <string>
#include <iostream>
namespace FaF
{
template <typename T>
class Allocator
{
public:
typedef T value_type;
Allocator() throw() {}
template <typename U> Allocator (const Allocator<U>&) throw() {}
~Allocator() throw() {}
T* allocate (std::size_t num, const void* hint = 0)
{
(void) hint; (void) num;
return new ( T );
}
void deallocate (T* p, std::size_t num) { (void) num; (void) p; }
};
using string = std::basic_string<char, std::char_traits<char>,
Allocator<char>>;
using smatch = std::match_results<FaF::string::const_iterator,
Allocator<FaF::string::const_iterator>>;
}
int main()
{
FaF::smatch results {};
std::cout << "OK\n";
}
gcc 8.2 complains here:
FaF::smatch results {};
^--- vector must have the same value as its allocator
Changing it to std::smatch then it compiles.
Compiler options:
-O3 -std=c++17 -Werror -Wextra -Wold-style-cast -Wall
Live version: https://godbolt.org/z/8wI6YS