Correctly diagnose taking the address of a register variable in C
authorAaron Ballman <aaron@aaronballman.com>
Thu, 22 Jul 2021 18:49:21 +0000 (14:49 -0400)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 22 Jul 2021 18:53:23 +0000 (14:53 -0400)
commit178c2b4c1eb12b2153adb384ac7f22a8791edc86
treed3fbebb6eb0ba18ca2bd4f8857552fe058ae475f
parent4e0cefc640672da0d09081c335aa982b5e7c8207
Correctly diagnose taking the address of a register variable in C

We caught the cases where the user would explicitly use the & operator,
but we were missing implicit conversions such as array decay.

Fixes PR26336. Thanks to Samuel Neves for inspiration for the patch.
clang/lib/Sema/Sema.cpp
clang/lib/Sema/SemaExpr.cpp
clang/test/Sema/expr-address-of.c