Bug 80749 - [concepts] noexcept specifier operands are allowed but ignored in compound requirements
Summary: [concepts] noexcept specifier operands are allowed but ignored in compound re...
Status: RESOLVED DUPLICATE of bug 80750
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: c++-concepts
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-15 04:15 UTC by Tom Honermann
Modified: 2017-05-15 04:29 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Honermann 2017-05-15 04:15:48 UTC
It appears that an operand provided to the noexcept specifier in compound requirements is ignored; the presence of any exception specification appears to be interpreted as introducing an exception constraint:

$ cat t.cpp
template<typename T>
concept bool C = requires { { T::smf() } noexcept(false); };
struct S1 {
  static void smf();
};
struct S2 {
  static void smf() noexcept;
};
static_assert(C<S1>);
static_assert(C<S2>);

$ g++ --version
g++ (GCC) 8.0.0 20170513 (experimental)
...

$ g++ -c -fconcepts t.cpp
t.cpp:9:1: error: static assertion failed
 static_assert(C<S1>);
 ^~~~~~~~~~~~~

In the above example, the expectation is that the compound requirement having a 'noexcept(false)' specifier will confer no exception constraint requirement and that both S1 and S2 should satisfy constraint checks.  However, S1 is rejected.

The test case above is ill-formed according to the Concepts TS (N4641) given that compound requirements are specified to only accept an optional 'noexcept' specifier (without operands):

ยง 5.1.4.3 Compound requirements     [expr.prim.req.compound]
  compound-requirement:
      { expression } noexcept[opt] trailing-return-type[opt] ;

gcc allows an operand to be specified, but appears not to evaluate it.  If the intent of the TS is to disallow operands to the noexcept specifier in compound requirements, then gcc should reject them.  Otherwise, if the intent of the TS is to allow operands, then gcc should evaluate them and conditionally apply exception constraints (and an issue opened with the Concepts TS).
Comment 1 Tom Honermann 2017-05-15 04:29:30 UTC
Closing as a duplicate of bug 80750 (web server connectivity issues resulted in multiple submissions).

*** This bug has been marked as a duplicate of bug 80750 ***