This website requires JavaScript.
Explore
Help
Sign In
maxjhandsome
/
llvm-project
forked from
OSchip/llvm-project
Watch
1
Star
0
Fork
You've already forked llvm-project
0
Code
Issues
Pull Requests
Packages
Releases
Wiki
Activity
4aacad1f93
llvm-project
/
clang
/
test
/
Sema
/
const-ptr-int-ptr-cast.c
6 lines
100 B
C
Raw
Normal View
History
Unescape
Escape
Fix for PR2720; be a little bit more permissive in initializers for casting pointers to integers. Eventually, we should check whether we can evaluate an expression using Expr::tryEvaluate, and this codepath should be tightened to only handle standard-compliant cases. llvm-svn: 55331
2008-08-26 04:46:57 +08:00
// RUN: clang -fsyntax-only -verify %s
Throw the switch to exclusively use Evaluate (along with the small helper isConstantInitializer) to check whether an initializer is constant. This passes tests, but it's possible that it'll cause regressions with real-world code. Future work: 1. The diagnostics obtained this way are lower quality at the moment; some work both here and in Evaluate is needed for accurate diagnostics. 2. We probably need some extra code when we're in -pedantic mode so we can strictly enforce the rules in C99 6.6p7. 3. Dead code cleanup (this should wait until after 2, because we might want to re-use some of the code). llvm-svn: 65265
2009-02-22 14:45:27 +08:00
#
include
<stdint.h>
char
*
a
=
(
void
*
)
(
uintptr_t
)
(
void
*
)
&
a
;