Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: conversion from int/float typed constant to complex variable changed in 1.14 [1.14 backport] #38123

gopherbot opened this issue Mar 28, 2020 · 3 comments


Copy link

@gopherbot gopherbot commented Mar 28, 2020

@ianlancetaylor requested issue #38117 to be considered for backport to the next 1.14 minor release.

Looks like we're going back to the 1.13 behavior. I'll let @griesemer review the CL, but:

@gopherbot Please open a backport to 1.14.

The compiler behavior changed the way it handles constant conversions. This can break existing programs with no workaround other than rewriting the program, which should not be needed.

Copy link

@andybons andybons commented Apr 7, 2020

Approved as this is a regression with no workaround.

@andybons andybons modified the milestones: Go1.14.2, Go1.14.3 Apr 8, 2020
Copy link

@gopherbot gopherbot commented May 7, 2020

Change mentions this issue: [release-branch.go1.14] cmd/compile: fix constant conversion involving complex types

Copy link

@gopherbot gopherbot commented May 8, 2020

Closed by merging f4274e6 to release-branch.go1.14.

@gopherbot gopherbot closed this May 8, 2020
gopherbot pushed a commit that referenced this issue May 8, 2020
…g complex types

In CL 187657, I refactored constant conversion logic without realizing
that conversions between int/float and complex types are allowed for
constants (assuming the constant values are representable by the
destination type), but are never allowed for non-constant expressions.

This CL expands convertop to take an extra srcConstant parameter to
indicate whether the source expression is a constant; and if so, to
allow any numeric-to-numeric conversion. (Conversions of values that
cannot be represented in the destination type are rejected by

Fixes #38123.
For #38117.

Change-Id: Id7077d749a14c8fd910be38da170fa5254819f2b
Run-TryBot: Matthew Dempsky <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Robert Griesemer <>
(cherry picked from commit 3431428)
Run-TryBot: Dmitri Shuralyov <>
Reviewed-by: Matthew Dempsky <>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.