1
0
mirror of https://github.com/golang/go synced 2024-11-26 17:26:56 -07:00
go/misc/cgo/test/issue28545.go
Ian Lance Taylor 4f26f24d2a cmd/cgo: recognize untyped constants defined in different files
An untyped constant can be defined in any input file, we shouldn't
segregate them by file.

Updates #28772

Change-Id: I0347f15236833bb511eb49f86c449ee9241b0a25
Reviewed-on: https://go-review.googlesource.com/c/151600
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-11-29 01:29:56 +00:00

27 lines
701 B
Go

// 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.
// Failed to add type conversion for negative constant.
// Issue 28772: Failed to add type conversion for Go constant set to C constant.
// No runtime test; just make sure it compiles.
package cgotest
/*
#include <complex.h>
#define issue28772Constant 1
static void issue28545F(char **p, int n, complex double a) {}
*/
import "C"
const issue28772Constant = C.issue28772Constant
func issue28545G(p **C.char) {
C.issue28545F(p, -1, (0))
C.issue28545F(p, 2+3, complex(1, 1))
C.issue28545F(p, issue28772Constant, issue28772Constant2)
}