Microsoft Edge

Try Microsoft Edge

A fast and secure browser that's designed for Windows 10 Get started

This site uses cookies for analytics, personalized content and ads. By continuing to browse this site, you agree to this use. Learn more
Microsoft Microsoft
    • .NET
      • Apps
      • Internet of Things
      • Mixed Reality
      • Microsoft Edge
      • Hardware
      • IT Center
      • What is Azure
      • Products
      • Solutions
      • Pricing
      • Create a free account
      • Visual Studio
      • Visual Studio IDE
      • Visual Studio Team Services
      • Visual Studio Code
      • Xamarin
      • Visual Studio Dev Essentials
      • Subscriptions
      • Office Dev Center
      • Office 365 for IT pros
    • Microsoft Graph
      • Store
      • Cortana
      • Bing
      • Application Insights
      • .NET
      • Microsoft Azure
      • Microsoft Graph
      • Visual Studio
      • Visual Studio Team Services
      • Windows
      • Office
      • All Developer Centers
    • TechNet
    • Microsoft Developer Network
      • Windows IT Center
      • Office 365 for IT Pros
      • All IT TechCenters
      • Microsoft Download Center
      • Microsoft Azure
      • Visual Studio
      • SDKs
      • Windows
      • Office
      • Microsoft Graph
      • MSDN
      • Azure
      • Windows
    • PowerShell scripts
      • Microsoft Azure
      • Visual Studio
      • Visual Studio Team Services
      • Developer tools
      • Office Dev Blog
      • Server & management
      • Windows
      • Developers
      • TechNet
      • Microsoft Tech Community
      • Visual Studio (MSDN) subscriptions
      • Microsoft Cloud Essentials
      • Microsoft Virtual Academy
      • IT Pro Career Center
    • Microsoft Evaluation Center
    • Channel 9
    • No results
    Sign in
    Developer Community Status
    Visual Studio

    Developer Community

    Get help from our community supported forum
    Visual Studio Visual Studio for Mac .NET C++ VSTS TFS
    All Products
    • Visual Studio
    • Visual Studio for Mac
    • .NET
    • C++
    • VSTS
    • TFS
    Report a problem
    • for Visual Studio
    • for Visual Studio for Mac
    • for .NET
    • for C++
    • for VSTS
    • for TFS
    Report an issue in Visual Studio Installer or Visual Studio
    This allows diagnostic information about the program to be included in your report
    1. Installer or Visual Studio
    2. Report a Problem
    3. Type and Submit
    Available on Visual Studio 2017, Installer, and newer releases
    Would you like to know more?
    • Home /
    • Visual Studio /
    avatar image
    0

    Compiler regression vs VS2013 with variadic operator() member function

    Reported by Beat Bolli Apr 05, 2017 at 09:32 PM Visual Studio 2017 version 15.1windows 10.0C++

    The attached source code demonstrates the regression, or I don't understand C++ any more...

    This syntax of the constructor (parentheses vs. braces) determines whether operator() is found correctly. The explicit .operator() call also works. The commented out call compiles fine on GNU g++, so I think the syntax is fine. It constructs a temporary object and immediately calls its operator().

    thub.nodes.view.add-new-comment
    Add comment Show 2
    10 |10000 characters needed characters left characters exceeded
    ▼
    • Viewable by all users
    • Viewable by moderators
    • Viewable by moderators and the original poster
    • Advanced visibility
    Viewable by all users
    avatar image Beat Bolli · Apr 05, 2017 at 09:38 PM 0
    Share

    It seems that the attachment isn't visible, so I'll put it here:

    avatar image Beat Bolli · Apr 05, 2017 at 09:48 PM 0
    Share

    enum LOG_LEVEL {

    LL_FATAL, LL_ERROR, LL_WARNING, LL_INFO

    };

    class MainLog {
    public:
    explicit MainLog(const char* ctx) : context(ctx) {}
    void operator()(LOG_LEVEL ll, const char* msgFormat, ...) {}

    private:
    const char* context;

    };

    void main() {

    // error C2661 : 'MainLog::MainLog' : no overloaded function takes 3 arguments

    // MainLog(__func__)(LL_INFO, "This is a %s", "test");

    // works:

    MainLog(__func__).operator()(LL_INFO, "This is a %s", "test");

    // works:

    MainLog{ __func__ }(LL_INFO, "This is a %s", "test");

    }

    Solutions

    · Add your solution

    Add a Solution

    Up to 2 attachments (including images) can be used with a maximum of 2.1 GB each and 2.1 GB total.

    Follow

    65 People are following this

    avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

    Related Problems

    Empty C++ console application project
    1 Solution

    VS2017 option "/Zi" should generate vc150.pdb instead of vc140.pdb
    0 Solution

    Visual Studio 2017 on Windows 10: C++ -> Cross Platform -> Linux -> using Bash on Windows on Ubuntu -> use std:: in program -> Stopped (tty input) occurred
    2 Solution

    vcvarsall.bat from VC++ 2015 v140 toolset does not work
    3 Solution

    visual c++ - windows runtime component
    1 Solution

    VS2017 C++ build/clean fails
    4 Solution

    无法找到文件kernel32.lib->Unable to find file Kernel32.lib
    1 Solution

    Microsoft.VisualC.CppCodeGenerator missing keyword(s)
    0 Solution

    "Edit and Continue" feature returns "Edit and Continue could not create a safe command line to compile changes. UNC, relative and remote drive paths are disallowed" with Toolset version v141 in Visual Studio 2017
    0 Solution

    The code link of Error List points wrong documentation
    0 Solution

    Popular
    • Windows Dev Center
    • Microsoft Azure
    • Microsoft Visual Studio
    • Office Dev Center
    • ASP.NET
    • IIS.NET
    Learning Resources
    • Channel 9
    • Windows development videos
    • Microsoft Virtual Academy
    Programs
    • Microsoft developer program
    • Windows Insider program
    • Microsoft Affiliate program
    • BizSpark (for startups)
    • Microsoft Imagine
    For IT Pros
    • Microsoft Power BI
    • Microsoft SQL Server
    • Internet of Things
    • Operations Management Suite
    English (United States)
    • Contact us
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • About our ads
    • © Microsoft 2018
    • Anonymous
    • Sign in
    • Spaces
    • Visual Studio
    • Visual Studio for Mac
    • .NET
    • C++
    • VSTS
    • TFS
    • Explore
    • Topics
    • Problems
    • Users
    • Badges