It could potentially under "fair use," which completely overrides any and all copyright claims if the conduct is found to be, indeed, "fair use."
Fair use in code is broader than just copying. For example, in Google v Oracle, APIs were found to be not copyrightable. Even if you copied the names of, say, 86,000 different functions in a proprietary library, you did not violate copyright.
Then comes the second problem. Let's say there is a function, say, `AddTwoNumbers(int a, int b)`. Just because John Fitzgerald in 1999 implemented that as `return a + b;" doesn't mean you can't too. There's a degree where you can copy the code that made a function work, even if that code existed earlier. It's fuzzy but it is legally real.
Finally, there is your third problem, which is that you risk a "safe harbor"-esque judgement. Just because YouTube has occasional copyright-violating content doesn't make YouTube illegal. Similarly, the person suing here risks a finding that GitHub Copilot is legal as long as any occasional long proprietary code regurgitations are removed as needed.
If your code falls under the first two conditions, copyright be damned, license be damned, it's all irrelevant. See also Linux copying Unix.
There must be a line past which copying is no longer "fair use", otherwise no copyrights in code would be enforceable at all. I suppose it is up to a court to decide, but in the Tim Davis thread from yesterday it looked to me like Copilot was emitting entire, nontrivial functions verbatim.
Fair use in code is broader than just copying. For example, in Google v Oracle, APIs were found to be not copyrightable. Even if you copied the names of, say, 86,000 different functions in a proprietary library, you did not violate copyright.
Then comes the second problem. Let's say there is a function, say, `AddTwoNumbers(int a, int b)`. Just because John Fitzgerald in 1999 implemented that as `return a + b;" doesn't mean you can't too. There's a degree where you can copy the code that made a function work, even if that code existed earlier. It's fuzzy but it is legally real.
Finally, there is your third problem, which is that you risk a "safe harbor"-esque judgement. Just because YouTube has occasional copyright-violating content doesn't make YouTube illegal. Similarly, the person suing here risks a finding that GitHub Copilot is legal as long as any occasional long proprietary code regurgitations are removed as needed.
If your code falls under the first two conditions, copyright be damned, license be damned, it's all irrelevant. See also Linux copying Unix.