Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

CWG2810 [temp.res.general] Templates should not silence diagnostics #428

Copy link
Copy link
Closed
cplusplus/draft
#6906
cplusplus/draft#6906
@Eisenwave

Description

@Eisenwave
Issue body actions

Reflector thread: https://lists.isocpp.org/core/2022/01/11929.php

Reference (section label): [temp.res.general]

Issue Description

In [temp.res.general] p6, it is stated that the program is ill-formed, no diagnostic required as the result of invalid constructs in templates, and:

Otherwise, no diagnostic shall be issued for a template for which a valid specialization can be generated.

The latter sentence serves no apparent purpose because the reader would not expect a diagnostic to be required if the program does not violate any of the listed conditions. Furthermore, it could be misinterpreted to mean that diagnostic messages such as optional warnings are required to be suppressed:

template <int> int foo(float x) {
    return x; // warning: conversion from float to int [-Wconversion]
}

Issuing a -Wconversion warning in this example could be seen as not conforming. Of course, an implementation could simply not treat -Wconversion as a diagnostic as per [defns.diagnostic]. However, this interpretation means that some warnings are diagnostics and some aren't, which is contrived, and complicated for the reader.

Suggested resolution

Update [temp.res.general] p6 as follows:

 [...]
-Otherwise, no diagnostic shall be issued for a template
-for which a valid specialization can be generated.
 [...]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.