]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
/cp
authorpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Jul 2014 16:22:19 +0000 (16:22 +0000)
committerpaolo <paolo@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Jul 2014 16:22:19 +0000 (16:22 +0000)
2014-07-17  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/50961
* call.c (standard_conversion): Use resolve_nondeduced_context
for type_unknown_p (EXPR) && TREE_CODE (TO) == BOOLEAN_TYPE.

/testsuite
2014-07-17  Paolo Carlini  <paolo.carlini@oracle.com>

PR c++/50961
* g++.dg/template/operator13.C: New.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@212760 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/operator13.C [new file with mode: 0644]

index e4b27f4112bdb431e7dff1bb4c0fb57b97893528..779e087e4441898472d934fbe5b554cf335cb86b 100644 (file)
@@ -1,3 +1,9 @@
+2014-07-17  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/50961
+       * call.c (standard_conversion): Use resolve_nondeduced_context
+       for type_unknown_p (EXPR) && TREE_CODE (TO) == BOOLEAN_TYPE.
+
 2014-07-17  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/61804
index ea8cb5f78c896787af3fc0a620800b2a628116d4..61e2769807bb514f62c69af50bb5978f0a3d097c 100644 (file)
@@ -1107,14 +1107,22 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
   to = strip_top_quals (to);
   from = strip_top_quals (from);
 
-  if ((TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to))
-      && expr && type_unknown_p (expr))
+  if (expr && type_unknown_p (expr))
     {
-      tsubst_flags_t tflags = tf_conv;
-      expr = instantiate_type (to, expr, tflags);
-      if (expr == error_mark_node)
-       return NULL;
-      from = TREE_TYPE (expr);
+      if (TYPE_PTRFN_P (to) || TYPE_PTRMEMFUNC_P (to))
+       {
+         tsubst_flags_t tflags = tf_conv;
+         expr = instantiate_type (to, expr, tflags);
+         if (expr == error_mark_node)
+           return NULL;
+         from = TREE_TYPE (expr);
+       }
+      else if (TREE_CODE (to) == BOOLEAN_TYPE)
+       {
+         /* Necessary for eg, TEMPLATE_ID_EXPRs (c++/50961).  */
+         expr = resolve_nondeduced_context (expr);
+         from = TREE_TYPE (expr);
+       }
     }
 
   fcode = TREE_CODE (from);
index 2e93ada4419c4f0a3f44e173c85758d82d6fbb53..55cf9e5d014407736c1804420bd57ebb59278828 100644 (file)
@@ -1,3 +1,8 @@
+2014-07-17  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       PR c++/50961
+       * g++.dg/template/operator13.C: New.
+
 2014-07-17  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * gcc.target/aarch64/simd/vfma_f64.c: New test.
diff --git a/gcc/testsuite/g++.dg/template/operator13.C b/gcc/testsuite/g++.dg/template/operator13.C
new file mode 100644 (file)
index 0000000..1967c91
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/50961
+
+template < class > void foo ();
+
+bool b1 = !foo<void>;
+bool b2 = foo<void> ? true : false;
+
+void bar()
+{
+  if (foo<void>)
+    ;
+}