[expr.reflect] Last example assumes sizeof(int)!=1 without saying as such

Open Beginner friendly
#9,330 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
86/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
cpp
Domain
documentation

Research direction

Read example 4 at expr.reflect#example-4 and compare the three constraints and their char/int instantiations. Update the example so it either states the sizeof(int) assumption or uses a type such as char[2], then confirm the example's ambiguity and validity remain clear.

Written by the indexing model from the issue text.

Description

[expr.reflect] example 4:

template<typename T> void fn() requires (^^T != ^^int);
template<typename T> void fn() requires (^^T == ^^int);
template<typename T> void fn() requires (sizeof(T) == sizeof(int));

constexpr std::meta::info a = ^^fn<char>;       // OK
constexpr std::meta::info b = ^^fn<int>;        // error: ambiguous

The validity of these being different only makes sense if sizeof(int) is not one. Replacing int with a type such as char[2] would remove the assumption.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Contributor guide

No contributing guide indexed for this repository

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.

More from cplusplus/draft

All issues in cplusplus/draft

Similar issues

More Documentation issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.