summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/pragmas.nim2
-rw-r--r--tests/pragmas/tpush.nim22
2 files changed, 23 insertions, 1 deletions
diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim
index d4817ce7a..a800edaf8 100644
--- a/compiler/pragmas.nim
+++ b/compiler/pragmas.nim
@@ -1313,7 +1313,7 @@ proc implicitPragmas*(c: PContext, sym: PSym, info: TLineInfo,
   if sym != nil and sym.kind != skModule:
     for it in c.optionStack:
       let o = it.otherPragmas
-      if not o.isNil:
+      if not o.isNil and sfFromGeneric notin sym.flags: # bug #23019
         pushInfoContext(c.config, info)
         var i = 0
         while i < o.len:
diff --git a/tests/pragmas/tpush.nim b/tests/pragmas/tpush.nim
index 6a95f1ca0..8ebbfe3d3 100644
--- a/tests/pragmas/tpush.nim
+++ b/tests/pragmas/tpush.nim
@@ -77,3 +77,25 @@ block: # bug #22913
     {.pop.}
 
     discard foo2()
+
+block: # bug #23019
+  proc f(x: bool)
+
+  proc a(x: int) =
+    if false: f(true)
+
+  proc f(x: bool) =
+    if false: a(0)
+
+  proc k(r: int|int) {.inline.} =  # seems to require being generic and inline
+    if false: a(0)
+
+
+  # {.push tags: [].}
+  {.push raises: [].}
+
+  {.push warning[ObservableStores]:off.}  # can be any warning, off or on
+  let w = 0
+  k(w)
+  {.pop.}
+  {.pop.}