microsoft / microsoft/STL

The CTAD of the standard container is still instantiated when Alloc does not satisfy Allocator.

Open
#4,060 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

LWG issue needed
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

Not sure if this is a language bug or a library bug:

https://godbolt.org/z/EY6K9eKP9

#include <vector>
#include <list>

template<template <class...> class Cnt, class Alloc>
concept can_ctad = requires (int* it) {
  Cnt(it, it, Alloc{});
};

struct NotAlloc { };

static_assert(!can_ctad<std::vector, NotAlloc>); // hard error in MSVC-STL
static_assert(!can_ctad<std::list, NotAlloc>); // hard error in MSVC-STL

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Godbolt reproducer and the static_assert cases for std::vector and std::list, then inspect the corresponding standard-container deduction guides and allocator constraints. Done means determining whether the hard error is conforming and, if not, adding a regression test that makes both can_ctad assertions compile successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.