How To Use DAC on STM32F4 Discovery?
Unfortunately, that wasn't a bug actually. It was me not knowing how to use the code generated by CubeMX.
I copied only the functions from the main.c generated by CubeMX, whereas I should also have copied the othere files from the src folder. One of those files contains the function HAL_DAC_MspInit() that takes care of all the clock enabling and pin initialization. This function is itself called in the HAL_DAC_Init() from the already included stm32f4xx_hal_dac.c file.
Anyway, thumbs up to all the people who replied to my post and helped me find out the problem.