Bug 66478 - [constexpr] accepts-invalid with read of non-constant variable as discarded value
Summary: [constexpr] accepts-invalid with read of non-constant variable as discarded v...
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 5.1.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: constexpr
  Show dependency treegraph
 
Reported: 2015-06-09 18:41 UTC by Richard Smith
Modified: 2021-07-23 12:01 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-06-23 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Richard Smith 2015-06-09 18:41:42 UTC
GCC accepts this ill-formed code:

  void f(int n) { static_assert((+n, true), ""); }

This is invalid because it reads the variable 'n', whose value is not known within the constant expression.