Files
swift-mirror/test/SILGen/diagnose_duplicate_functions.swift
Erik Eckstein dccaa8f01f diagnose duplicated @_cdecl and @_silgen_name function names
Prints a regular error instead of crashing.
The check is done in SILGen, because it's simple. We could also do it earlier, but I don't see a strong reason for this.

rdar://75950093
2021-03-31 13:30:22 +02:00

22 lines
408 B
Swift

// RUN: %target-swift-emit-silgen %s -o /dev/null -verify
@_silgen_name("foo")
func a(_ x: Int) -> Int {
return x
}
@_silgen_name("foo")
func b(_ x: Int) -> Int { // expected-error {{multiple definitions of symbol 'foo'}}
return x
}
@_cdecl("bar")
func c(_ x: Int) -> Int {
return x
}
@_cdecl("bar")
func d(_ x: Int) -> Int { // expected-error {{multiple definitions of symbol 'bar'}}
return x
}