Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8057133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T08:55:39+00:00 2026-06-05T08:55:39+00:00

Synopsis I am struggling with making C++11 code Clang compatible and ran into a

  • 0

Synopsis

I am struggling with making C++11 code Clang compatible and ran into a case where GCC >= 4.6 accepts code and Clang >= 3.1 doesn’t. Clang deems a candidate constructor not viable.

Details

Here is a trimmed down example to illustrate the issue:

#include <utility>

template <typename...>
struct T;

template<>
struct T<>
{
    typedef T super;

    constexpr T() { }

    template <typename... Args>
    T(Args&&...) { }

};

template <typename Head, typename... Tail>
struct T<Head, Tail...> : T<Tail...>
{
    typedef T<Tail...> super;

    Head head;

    T(Head arg) : super(), head(std::move(arg)) { }
};


struct void_type
{
    constexpr void_type() { }
    constexpr void_type(const void_type&) { }
    void_type& operator=(const void_type&) = default;

    template <typename Arg0, typename... Args>
    void_type(Arg0&&, Args&&...) { }
};

struct atom { };

int main()
{
    atom a;
    T<void_type> t(a);

    return 0;
}

The error I get is:

ctor-init.cpp:44:18: error: no matching constructor for initialization of 'T<void_type>'
    T<void_type> t(a);
                 ^ ~
ctor-init.cpp:19:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'atom' to 'const T<void_type>' for 1st argument;
struct T<Head, Tail...> : T<Tail...>
       ^
ctor-init.cpp:25:5: note: candidate constructor not viable: no known conversion from 'atom' to 'void_type' for 1st argument;
    T(Head arg) : super(), head(std::move(arg)) { }
    ^
1 error generated.

I do not understand why clang complains about the lack of a conversion possibility, because I think this “catch-all” constructor should work:

template <typename Arg0, typename... Args>
void_type(Arg0&&, Args&&...) { }

So the error I am confused about is:

ctor-init.cpp:25:5: note: candidate constructor not viable: no known conversion from 'atom' to 'void_type' for 1st argument;
    T(Head arg) : super(), head(std::move(arg)) { }
    ^

After all, GCC accepts the code. Is this perhaps a Clang bug? (I am using the latest Clang from the LLVM git repository.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T08:55:41+00:00Added an answer on June 5, 2026 at 8:55 am

    Indeed, this was a Clang bug. It turned out that variadic constructors are mistakenly marked as explicit. Fixed in Clang r158040.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Brief synopsis, this code works beautifully and does what it is supposed except with
How can you pick pages from a PDF file? Pseudo-code synopsis pick-pages 1,2-69,70-73,100 example.pdf
Here is my code thus far: $(document).ready(function(){ $(.KD).click(function(){ $(p).load('KD.html'); $(.video).load('KDVideo.html'); $(.synopsis-change).toggleClass(synopsis); $(.synopsis).toggleClass(synopsis-change); }); });
Synopsis : When calling an executable that links to shared libraries from Java code
Here is my code: $(function() { $(#page-flip).mouseover(function() { $(.box).toggleClass(box-change); $(.films).toggleClass(films-change); $(.synopsis).toggleClass(synopsis-change); }); }); It
Synopsis: My program occasionally runs into a condition where it wants to send data
I'm looking into the feasibility of writing a code formatting tool for the Apex
Before delving into my question, I should first provide a synopsis of what angle
Just getting started with WF4. Ran into a problem with passing some text from
Here is a synopsis of my code which is a moderately complex WinForms GUI.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.