diff --git a/src/compiler/codegen/index.js b/src/compiler/codegen/index.js
index 46c54867bb..c4c31c2020 100644
--- a/src/compiler/codegen/index.js
+++ b/src/compiler/codegen/index.js
@@ -309,7 +309,7 @@ function genDirectives (el: ASTElement, state: CodegenState): string | void {
function genInlineTemplate (el: ASTElement, state: CodegenState): ?string {
const ast = el.children[0]
if (process.env.NODE_ENV !== 'production' && (
- el.children.length > 1 || ast.type !== 1
+ el.children.length !== 1 || ast.type !== 1
)) {
state.warn('Inline-template components must have exactly one child element.')
}
diff --git a/test/unit/modules/compiler/codegen.spec.js b/test/unit/modules/compiler/codegen.spec.js
index 37bcf62a76..8b415a13eb 100644
--- a/test/unit/modules/compiler/codegen.spec.js
+++ b/test/unit/modules/compiler/codegen.spec.js
@@ -455,7 +455,14 @@ describe('codegen', () => {
'
',
`with(this){return _c('my-component',{inlineTemplate:{render:function(){with(this){return _c('hr')}},staticRenderFns:[]}})}`
)
+ try {
+ assertCodegen(
+ '',
+ ''
+ )
+ } catch (e) {}
expect('Inline-template components must have exactly one child element.').toHaveBeenWarned()
+ expect(console.error.calls.count()).toBe(2)
})
it('generate static trees inside v-for', () => {