aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c/c-typeck.c1
-rw-r--r--gcc/testsuite/gcc.dg/pr101171.c13
2 files changed, 14 insertions, 0 deletions
diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c
index d0d36c3..d079ce4 100644
--- a/gcc/c/c-typeck.c
+++ b/gcc/c/c-typeck.c
@@ -6131,6 +6131,7 @@ build_c_cast (location_t loc, tree type, tree expr)
return value reflects this. */
if (int_operands
&& INTEGRAL_TYPE_P (type)
+ && value != error_mark_node
&& !EXPR_INT_CONST_OPERANDS (value))
value = note_integer_operands (value);
diff --git a/gcc/testsuite/gcc.dg/pr101171.c b/gcc/testsuite/gcc.dg/pr101171.c
new file mode 100644
index 0000000..8d2bcab
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr101171.c
@@ -0,0 +1,13 @@
+/* PR c/101171 */
+/* { dg-do compile } */
+/* { dg-options "" } */
+
+extern void foo (void);
+int x = 0x1234;
+
+void
+bar (void)
+{
+ if (x != (sizeof ((enum T) 0x1234))) /* { dg-error "conversion to incomplete type" } */
+ foo ();
+}