mirror of
https://github.com/nim-lang/Nim.git
synced 2026-08-26 00:21:42 +00:00
Merge branch 'devel' into araq-icu
This commit is contained in:
@@ -75,3 +75,15 @@ block: # importc type inheritance
|
||||
doAssert(cast[cint](b) == 123)
|
||||
var c = foo(b)
|
||||
doAssert(cast[cint](c) == 123)
|
||||
|
||||
block: # bug #25945
|
||||
var stateRefund = 0
|
||||
let authCode =
|
||||
if true:
|
||||
if false:
|
||||
stateRefund += 0
|
||||
@[]
|
||||
else:
|
||||
@([1.byte])
|
||||
|
||||
discard (if true: (discard; @[]) else: @[0])
|
||||
|
||||
30
tests/cpp/tcpp_default_ctor_assignment.h
Normal file
30
tests/cpp/tcpp_default_ctor_assignment.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef TCPP_DEFAULT_CTOR_ASSIGNMENT_H
|
||||
#define TCPP_DEFAULT_CTOR_ASSIGNMENT_H
|
||||
|
||||
struct AmbiguousAssign {
|
||||
int x;
|
||||
const char* y;
|
||||
|
||||
AmbiguousAssign(): x(0), y(nullptr) {}
|
||||
AmbiguousAssign(int x, const char* y): x(x), y(y) {}
|
||||
|
||||
AmbiguousAssign& operator=(int v) {
|
||||
x = v;
|
||||
y = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
AmbiguousAssign& operator=(const char* s) {
|
||||
x = 0;
|
||||
y = s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
AmbiguousAssign& operator=(const AmbiguousAssign& other) {
|
||||
x = other.x;
|
||||
y = other.y;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
14
tests/cpp/tcpp_default_ctor_assignment.nim
Normal file
14
tests/cpp/tcpp_default_ctor_assignment.nim
Normal file
@@ -0,0 +1,14 @@
|
||||
discard """
|
||||
cmd: "nim cpp $file"
|
||||
"""
|
||||
|
||||
type
|
||||
AmbiguousAssign {.importcpp, header: "tcpp_default_ctor_assignment.h".} = object
|
||||
x: cint
|
||||
y: cstring
|
||||
|
||||
proc main =
|
||||
var xs = newSeq[AmbiguousAssign](3)
|
||||
doAssert xs.len == 3
|
||||
|
||||
main()
|
||||
@@ -855,3 +855,17 @@ block:
|
||||
var r = Obj(x: 10)
|
||||
r.value = 42
|
||||
doAssert r.x == 42
|
||||
|
||||
block: # bug #25949
|
||||
template loadFile(filename: string): auto =
|
||||
when nimvm:
|
||||
staticRead(filename)
|
||||
else:
|
||||
"something"
|
||||
|
||||
proc roundTrip(): bool =
|
||||
let content = loadFile("tests/tomls/case.toml")
|
||||
content == "something"
|
||||
|
||||
doAssert roundTrip()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user