diff --git a/src/compiler/codegen/events.js b/src/compiler/codegen/events.js
index 8ce9e1b58e1..44657e38cd8 100644
--- a/src/compiler/codegen/events.js
+++ b/src/compiler/codegen/events.js
@@ -1,6 +1,6 @@
/* @flow */
-const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*\(/
+const fnExpRE = /^([\w$_]+|\([^)]*?\))\s*=>|^function\s*(?:[\w$]+)?\s*\(/
const fnInvokeRE = /\([^)]*?\);*$/
const simplePathRE = /^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*|\['[^']*?']|\["[^"]*?"]|\[\d+]|\[[A-Za-z_$][\w$]*])*$/
diff --git a/test/unit/modules/compiler/codegen.spec.js b/test/unit/modules/compiler/codegen.spec.js
index e56b25766f2..e946e218491 100644
--- a/test/unit/modules/compiler/codegen.spec.js
+++ b/test/unit/modules/compiler/codegen.spec.js
@@ -500,6 +500,11 @@ describe('codegen', () => {
'',
`with(this){return _c('input',{on:{"input":function () { current++ }}})}`
)
+ // normal named function
+ assertCodegen(
+ '',
+ `with(this){return _c('input',{on:{"input":function fn () { current++ }}})}`
+ )
// arrow with no args
assertCodegen(
'current++">',