This is an archive of the discontinued LLVM Phabricator instance.

Fix ICE with constexpr and friend functions
ClosedPublic

Authored by ogoffart on Feb 7 2016, 11:39 AM.

Details

Summary

Fix a crash while parsing this code:

    
struct X  {
  friend constexpr int foo(X*) { return 12; }
  static constexpr int j = foo(static_cast<X*>(nullptr));
};

I also added a test for the static function case because i don't think this was tested before.

Diff Detail

Event Timeline

ogoffart updated this revision to Diff 47144.Feb 7 2016, 11:39 AM
ogoffart retitled this revision from to Fix ICE with constexpr and friend functions .
ogoffart updated this object.
ogoffart added reviewers: rsmith, cfe-commits.
ogoffart updated this revision to Diff 47146.Feb 7 2016, 11:58 AM

Optimized by avoiding repeated call to getBody

rsmith accepted this revision.Feb 11 2016, 5:27 PM
rsmith edited edge metadata.

LGTM, thanks!

This revision is now accepted and ready to land.Feb 11 2016, 5:27 PM
This revision was automatically updated to reflect the committed changes.