LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 4402 - Add pedantic checking for constant expressions to clang
Summary: Add pedantic checking for constant expressions to clang
Status: NEW
Alias: None
Product: clang
Classification: Unclassified
Component: Frontend (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
: 4306 49581 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-06-16 19:44 PDT by Eli Friedman
Modified: 2021-03-15 15:23 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eli Friedman 2009-06-16 19:44:19 PDT
From Sema::CheckForConstantInitializer:
  // FIXME: Need strict checking.  In C89, we need to check for
  // any assignment, increment, decrement, function-calls, or
  // commas outside of a sizeof.  In C99, it's the same list,
  // except that the aforementioned are allowed in unevaluated
  // expressions.  Everything else falls under the
  // "may accept other forms of constant expressions" exception.
  // (We never end up here for C++, so the constant expression
  // rules there don't matter.)

Filing here for completeness.  This is relatively low-priority because it's a non-trivial amount of work, and it's a warning nobody would care about outside of -pedantic mode.
Comment 1 Kaelyn Takata 2012-06-19 16:10:59 PDT
*** Bug 4306 has been marked as a duplicate of this bug. ***
Comment 2 Richard Smith 2021-03-15 15:23:00 PDT
*** Bug 49581 has been marked as a duplicate of this bug. ***