You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When create a field with default value include "" in it, it will generate a C error.
Reproduction Steps
o.v
modulemainimportdb.mysqlfnmain() {
db:=db_mysql() or { panic('failed to connect to database') }
sql db {
create table User
} or { panic(err) }
}
@[table: 'sys_users']
structUser {
pub:
home_path ?string @[default: '"dashboard"'; sql_type: 'VARCHAR(64)'] // "dashboard" will compile fail.
}
fndb_mysql() !mysql.DB {
mutmysql_config:= mysql.Config{
host: '127.0.0.1'
port: 3306
username: 'root'
password: '12345678'
dbname: 'vcore'
}
mutconn:= mysql.connect(mysql_config) or {
return err
}
return conn
}
v o.v
Expected Behavior
compile ok
Current Behavior
$ v o.v
================== C compilation error (from tcc): ==============
cc: /tmp/v_1000/o.01JQ9CGNBWZD724RNJ8FXMAJF7.tmp.c:10572: warning: assignment discards qualifiers from pointer target type
cc: /tmp/v_1000/o.01JQ9CGNBWZD724RNJ8FXMAJF7.tmp.c:10612: error: ')' expected (got "dashboard")
...
cc: /tmp/v_1000/o.01JQ9CGNBWZD724RNJ8FXMAJF7.tmp.c:10612: error: ')' expected (got "dashboard")
(note: the original output was 4 lines long; it was truncated to its first 2 lines + the last line)
=================================================================
(You can pass `-cg`, or `-show-c-output` as well, to print all the C error messages).
builder error:
==================
C error found. It should never happen, when compiling pure V code.
This is a V compiler bug, please report it using `v bug file.v`,
or goto https://github.com/vlang/v/issues/new/choose .
You can also use #help on Discord: https://discord.gg/vlang .
Describe the bug
When create a field with default value include
""in it, it will generate a C error.Reproduction Steps
o.v
Expected Behavior
compile ok
Current Behavior
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.10 bd2ec67.f7f89b3
Environment details (OS name and version, etc.)
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.