-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cgo: make sure we FinishType everything
Ensure that we call FinishType on all the types added to the ptrs map. We only add a key to ptrKeys once. Once we FinishType for that key, we'll never look at that key again. But we can add a new type under that key later, and we'll never finish it. Make sure we add the key to the ptrKeys list every time we make the list of types for that key non-empty. This makes sure we FinishType each pointer type exactly once. Fixes golang#26517 Change-Id: Iad86150d516fcfac167591daf5a26c38bec7d143 Reviewed-on: https://go-review.googlesource.com/126275 Reviewed-by: Ian Lance Taylor <[email protected]>
- Loading branch information
Showing
2 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2018 The Go Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package cgotest | ||
|
||
// Introduce two pointer types which are distinct, but have the same | ||
// base type. Make sure that both of those pointer types get resolved | ||
// correctly. Before the fix for 26517 if one of these pointer types | ||
// was resolved before the other one was processed, the second one | ||
// would never be resolved. | ||
// Before this issue was fixed this test failed on Windows, | ||
// where va_list expands to a named char* type. | ||
|
||
/* | ||
#include <stdarg.h> | ||
typedef va_list TypeOne; | ||
typedef char *TypeTwo; | ||
*/ | ||
import "C" | ||
|
||
var a C.TypeOne | ||
var b C.TypeTwo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters