This is an archive of the discontinued LLVM Phabricator instance.

Remove ValueDependent assertions on ICE checks.
AbandonedPublic

Authored by mattd on Nov 23 2017, 11:40 AM.

Details

Reviewers
None
Summary

In the case of ill-formed templates, a value dependent name can reach the integral constant expression (ICE) check. After an error occurs following an ill-formed template, an ICE check can be performed on a template definition. That definition might contain an expression, such as "const a = sizeof(T);" where T is a template type argument. In this case, the latter expression is ValueDependent, T is type dependent, and the sizeof expression is therefore considered Value Dependent.

The assertions will trigger, if the implementation of a templated member function occurs in a separate namespace from its definition (bad code). If such a case occurs, an ODR marking of a variable decl is performed, which happens to check that a particular variable is constant.

Additionally, ValueDependent items can be ICEs, but we never check that case, and the assertions assume we never see them in the first place. In general, I don't like removing assertions, for obvious reasons. But in this case, I am not sure they are necessary, and can be problematic as seen by the included test case.

Diff Detail

Event Timeline

mattd created this revision.Nov 23 2017, 11:40 AM
mattd added a subscriber: cfe-commits.
mattd abandoned this revision.Jan 2 2018, 4:22 PM

Abandoning as this is no longer a problem with release builds.

mattd removed a reviewer: rsmith.Jan 2 2018, 4:23 PM
mattd removed a subscriber: cfe-commits.