diff mbox

Go patch committed: Fix bug in type of shortcut operation

Message ID mcr4n9i0yfh.fsf@iant-glaptop.roam.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor Sept. 18, 2013, 6:36 p.m. UTC
When the Go frontend converts a shortcut operator like && or || to an if
statement, it used the wrong type for the temporary variable.  It always
used bool, but the operator could be using a named version of bool.
This matters when the type has methods.  This patch fixes the problem.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline and 4.8 branch.

Ian
diff mbox

Patch

diff -r 35afa97b6c21 go/gogo.cc
--- a/go/gogo.cc	Tue Sep 17 15:09:45 2013 -0700
+++ b/go/gogo.cc	Wed Sep 18 11:30:33 2013 -0700
@@ -2367,7 +2367,7 @@ 
   Block* retblock = new Block(enclosing, loc);
   retblock->set_end_location(loc);
 
-  Temporary_statement* ts = Statement::make_temporary(Type::lookup_bool_type(),
+  Temporary_statement* ts = Statement::make_temporary(shortcut->type(),
 						      left, loc);
   retblock->add_statement(ts);