3

I have this declaration:

    template<class... Types>
    static void DispatchCompute(
        EffectFramework& frame_work,
        const std::string& shader_path,
        const std::vector<GpuDataBufferInfo<VulkanImage*>>& textures,
        const std::vector<GpuDataBufferInfo<VulkanBuffer>>& buffers,
        const Eigen::Vector3i& work_groups = {1, 0, 0},
        const Types&... args);

And lower down I have the definition. Gcc compiles this code just fine, but clang errors with:

error: missing default argument on parameter 'args' const Types&... args)

As far as I know the above is perfectly valid C++, you can add a variadic list after a default argument. I am not sure how to circumvent the error.

Makogan
  • 8,208
  • 7
  • 44
  • 112
  • I have no idea what (if anything) the "standard" says. But there are practical issues. Look [here](https://stackoverflow.com/questions/14805192), [here](https://stackoverflow.com/a/33672904/421195) and [here](https://www.cppstories.com/2021/non-terminal-variadic-args/) for discussion, and potential workarounds. – paulsm4 Jul 12 '21 at 06:13
  • Thank you for the tips, however, as far as I can see those are about having default values in thr variadic list, and they all involve complicated use of templates, which highly obfuscates the logic. :\ – Makogan Jul 12 '21 at 06:19
  • Which version are you using? clang >= 11 seems working https://godbolt.org/z/Ksj9fhdM1 – 김선달 Jul 12 '21 at 06:47
  • Seems I am using this version: `clang version 10.0.0-4ubuntu1 ` – Makogan Jul 12 '21 at 06:51
  • Yes, I did not find that when i first searched, this is then a duplicate – Makogan Jul 12 '21 at 07:02

0 Answers0