vermiculus / sx.el

Stack Exchange for Emacs
http://stackapps.com/q/3950
709 stars 40 forks source link

No answer is displayed when viewing a question #311

Closed ngquerol closed 8 years ago

ngquerol commented 8 years ago

Using the latest emacs-mac port (emacs-24.5-z-mac-5.15) and a fresh install of sx.el (20151111.1846 at the time of writing), opening a question with RET only displays the question itself, and the following message show up in the *Messages* buffer:

sx-question-mode--skip-comments: Symbol's function definition is void: markdown-match-comments

This is with a completely vanilla configuration. Here's a screenshot:

capture d ecran 2015-12-16 a 16 55 49
vermiculus commented 8 years ago

My gut instinct: is markdown-mode installed? Is it up-to-date?

ngquerol commented 8 years ago

According to list-packages, it is: markdown-mode 20151216.405

Malabarba commented 8 years ago

My gut instinct is that markdown mode got updated and removed that function. 😥

manuel-uberti commented 8 years ago

I can confirm this issue. markdown-mode has had various updates lately.

Malabarba commented 8 years ago

We should ask them to add back that function. They probably don't even know that there's a package actually depending on markdown-mode functions.

manuel-uberti commented 8 years ago

Ping @jrblevin.

jrblevin commented 8 years ago

Indeed, I am in the middle of refactoring and hopefully improving the font lock system in markdown-mode. I'm now using syntax table properties for comments, so I didn't need that comment matcher function, but I will add it back shortly. It will match comments based on syntax properties instead of regular expressions, but hopefully that won't make a difference in your usage.

jrblevin commented 8 years ago

Here you go. Let me know if there are any more issues.

https://github.com/jrblevin/markdown-mode/commit/f87a3da919738e5753185fe6cd5b1511193b419e

ngquerol commented 8 years ago

Seems to work fine, answers are correctly displayed now. However (hate to be that guy), most questions take a very long time to open (> 30 sec.) and upon canceling via C-g, I am shown the following message in the *Warnings* buffer:

Warning (undo): Buffer `*sx-question*' undo info was 12190702 bytes long.
The undo info was discarded because it exceeded `undo-outer-limit'.

This is normal if you executed a command that made a huge change
to the buffer.  In that case, to prevent similar problems in the
future, set `undo-outer-limit' to a value that is large enough to
cover the maximum size of normal changes you expect a single
command to make, but not so large that it might exceed the
maximum memory allotted to Emacs.

If you did not execute any such command, the situation is
probably due to a bug and you should report it.

You can disable the popping up of this buffer by adding the entry
(undo discard-info) to the user option `warning-suppress-types',
which is defined in the `warnings' library.

Does anyone else gets the same behavior, and shall I open another issue?

vermiculus commented 8 years ago

Holy cow, that's a big buffer. What question are you trying to view?

ngquerol commented 8 years ago

It seems to happen on almost every question, e.g. this one:

http://emacs.stackexchange.com/questions/18924/new-magit-interface-no-actual-push

manuel-uberti commented 8 years ago

Happens on every question for me: GNU Emacs 25.0.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.14.5) of 2015-12-18; Debian Jessie.

Malabarba commented 8 years ago

Thanks everyone. Could someone use debug-on-quit to find out where the hang is happening?

ngquerol commented 8 years ago

Here's what I get on the question I mentioned earlier:

https://gist.github.com/ngquerol/5ba4878c76772f372ac2

jrblevin commented 8 years ago

I've been working on markdown-mode this morning, specifically with respect to improving the performance of font-locking. In case it's related, let me know if it helped.

manuel-uberti commented 8 years ago

@jrblevin just upgraded from MELPA. Still no luck for me, same maximum memory allotted to Emacs error.

manuel-uberti commented 8 years ago

Any luck on this one?

manuel-uberti commented 8 years ago

@jrblevin @vermiculus @Malabarba ping

jrblevin commented 8 years ago

Once someone tracks down why this is happening, let me know if there is anything I can do on the markdown-mode end.

Malabarba commented 8 years ago

Sorry for the delay. Things are a mess on my side due to the holidays.

tomjakubowski commented 8 years ago

This seems to happen on every question for me. Here's a debug-on-quit backtrace (gist):

Debugger entered--Lisp error: (quit)
  replace-regexp-in-string("[[:space:]]+\\'" "" "lass, when that classes uses the PIMPL pattern.\n\nFoo.h:\n\n")
  sx-babel--make-pre-button(427 370)
  sx-question-mode--skip-and-fontify-pre()
  sx-question-mode--dont-fill-here()
  sx-question-mode--process-markdown-in-region(283 2215)
  sx-question-mode--insert-markdown("I'm getting a compile error in Visual Studio 2015 when I try to declare a variable of class, when that classes uses the PIMPL pattern.\n\nFoo.h:\n\n    #pragma once\n\n    class Foo\n    {\n    public:\n      Foo(const std::wstring& str,\n          const std::vector<std::wstring>& items);\n      ~Foo();\n\n    private:\n      struct Impl;\n      std::unique_ptr<Impl> pimpl;\n    };\n\nFoo.cpp:\n\n    #include \"stdafx.h\"\n    #include \"Foo.h\"\n\n    struct Foo::Impl\n    {\n    public:\n      Impl(const std::wstring& str,\n           const std::vector<std::wstring>& items);\n\n      std::wstring str_;\n      std::vector<std::wstring> items_;\n    };\n\n    Foo::Foo(const std::wstring& str,\n             const std::vector<std::wstring>& items)\n      : pimpl(std::make_unique<Impl>(str, items))\n    {\n    }\n\n    Foo::~Foo() = default;\n\n    Foo::Impl::Impl(const std::wstring& str,\n                    const std::vector<std::wstring>& items)\n      : str_(str),\n      items_(items)\n    {\n    }\n\nIf I declare a variable of type `Foo` using the traditional syntax, it compiles fine:\n\n      Foo f(L\"Hello\", std::vector<std::wstring>());\n\nHowever, if I declare it using `auto`, then I get a compile error:\n\n      auto f2 = Foo { L\"Goodbye\", std::vector<std::wstring>() };\n\n> error C2280: 'Foo::Foo(const Foo &)': attempting to reference a deleted function  \n> note: compiler has generated 'Foo::Foo' here\n\nI understand that the copy constructor for `Foo` should be deleted, since `unique_ptr` can't be copied. However, it was my understanding that when declaring variables in this way, the result would be either moved into the variable or just set the value into the variable directly.\n\nThe second line compiles fine when using Visual Studio 2013. I checked the breaking changes in Visual Studio 2015, but I didn't see anything there that would indicate why this started failing.\n\nAm I doing something wrong, or can this syntax not be used with non-copyable types?")
  sx-question-mode--print-section(((title . "Why can't I declare a variable using auto?") (site_par . "stackoverflow") (link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto") (body_markdown . "I'm getting a compile error in Visual Studio 2015 when I try to declare a variable of class, when that classes uses the PIMPL pattern.\n\nFoo.h:\n\n    #pragma once\n\n    class Foo\n    {\n    public:\n      Foo(const std::wstring& str,\n          const std::vector<std::wstring>& items);\n      ~Foo();\n\n    private:\n      struct Impl;\n      std::unique_ptr<Impl> pimpl;\n    };\n\nFoo.cpp:\n\n    #include \"stdafx.h\"\n    #include \"Foo.h\"\n\n    struct Foo::Impl\n    {\n    public:\n      Impl(const std::wstring& str,\n           const std::vector<std::wstring>& items);\n\n      std::wstring str_;\n      std::vector<std::wstring> items_;\n    };\n\n    Foo::Foo(const std::wstring& str,\n             const std::vector<std::wstring>& items)\n      : pimpl(std::make_unique<Impl>(str, items))\n    {\n    }\n\n    Foo::~Foo() = default;\n\n    Foo::Impl::Impl(const std::wstring& str,\n                    const std::vector<std::wstring>& items)\n      : str_(str),\n      items_(items)\n    {\n    }\n\nIf I declare a variable of type `Foo` using the traditional syntax, it compiles fine:\n\n      Foo f(L\"Hello\", std::vector<std::wstring>());\n\nHowever, if I declare it using `auto`, then I get a compile error:\n\n      auto f2 = Foo { L\"Goodbye\", std::vector<std::wstring>() };\n\n> error C2280: 'Foo::Foo(const Foo &)': attempting to reference a deleted function  \n> note: compiler has generated 'Foo::Foo' here\n\nI understand that the copy constructor for `Foo` should be deleted, since `unique_ptr` can't be copied. However, it was my understanding that when declaring variables in this way, the result would be either moved into the variable or just set the value into the variable directly.\n\nThe second line compiles fine when using Visual Studio 2013. I checked the breaking changes in Visual Studio 2015, but I didn't see anything there that would indicate why this started failing.\n\nAm I doing something wrong, or can this syntax not be used with non-copyable types?") (share_link . "http://stackoverflow.com/q/34858457/692055") (question_id . 34858457) (last_edit_date . 1453131941) (creation_date . 1453131263) (last_activity_date . 1453131941) (score . 4) (answer_count . 2) (accepted_answer_id . 34858568) (view_count . 187) (is_answered . t) (upvoted) (downvoted) (last_editor (link . "http://stackoverflow.com/users/636019/ildjarn") (display_name . "ildjarn") (profile_image . "https://www.gravatar.com/avatar/38ba39c7ba510ac2951c010c26afb6a6?s=128&d=identicon&r=PG") (user_type . "registered") (user_id . 636019) (reputation . 42901)) (owner (link . "http://stackoverflow.com/users/3857/andy") (display_name . "Andy") (profile_image . "https://www.gravatar.com/avatar/21599de27f8bc6cc7e9b3d002addbca8?s=128&d=identicon&r=PG") (accept_rate . 100) (user_type . "registered") (user_id . 3857) (reputation . 18755)) (answers ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858538#34858538") (body_markdown . "Because the class contains a [`std::unique_ptr`](http://en.cppreference.com/w/cpp/memory/unique_ptr) member the compiler can't generate a copy-constructor like it would normally do, which means your declaration and initialization (which invokes the copy-constructor) will not be possible.\n\nYou could solve it by making a [move constructor](http://en.cppreference.com/w/cpp/language/move_constructor) for your class and mark it as `default`.") (share_link . "http://stackoverflow.com/a/34858538/692055") (question_id . 34858457) (answer_id . 34858538) (creation_date . 1453131440) (last_activity_date . 1453131440) (score . 5) (is_accepted) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/440558/joachim-pileborg") (display_name . "Joachim Pileborg") (profile_image . "https://i.stack.imgur.com/9ZYta.jpg?s=128&g=1") (accept_rate . 75) (user_type . "registered") (user_id . 440558) (reputation . 177029))) ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858568#34858568") (body_markdown . "The move constructor is not implicitly declared, because you have a user-declared destructor (see [[class.copy]/(9.4)][1]). However, the copy constructor is clearly deleted, since `unique_ptr` can't be copied.\n\nYou can explicitly declare the move constructor as defaulted.\n\n\n  [1]: http://eel.is/c++draft/class.copy#9") (share_link . "http://stackoverflow.com/a/34858568/692055") (question_id . 34858457) (answer_id . 34858568) (creation_date . 1453131565) (last_activity_date . 1453131565) (score . 10) (is_accepted . t) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/3647361/columbo") (display_name . "Columbo") (profile_image . "https://i.stack.imgur.com/xvjhM.png?s=128&g=1") (accept_rate . 83) (user_type . "registered") (user_id . 3647361) (reputation . 35995)))) (tags "c++" "c++11" "visual-c++" "visual-studio-2015" "move-semantics")))
  sx-question-mode--print-question(((title . "Why can't I declare a variable using auto?") (site_par . "stackoverflow") (link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto") (body_markdown . "I'm getting a compile error in Visual Studio 2015 when I try to declare a variable of class, when that classes uses the PIMPL pattern.\n\nFoo.h:\n\n    #pragma once\n\n    class Foo\n    {\n    public:\n      Foo(const std::wstring& str,\n          const std::vector<std::wstring>& items);\n      ~Foo();\n\n    private:\n      struct Impl;\n      std::unique_ptr<Impl> pimpl;\n    };\n\nFoo.cpp:\n\n    #include \"stdafx.h\"\n    #include \"Foo.h\"\n\n    struct Foo::Impl\n    {\n    public:\n      Impl(const std::wstring& str,\n           const std::vector<std::wstring>& items);\n\n      std::wstring str_;\n      std::vector<std::wstring> items_;\n    };\n\n    Foo::Foo(const std::wstring& str,\n             const std::vector<std::wstring>& items)\n      : pimpl(std::make_unique<Impl>(str, items))\n    {\n    }\n\n    Foo::~Foo() = default;\n\n    Foo::Impl::Impl(const std::wstring& str,\n                    const std::vector<std::wstring>& items)\n      : str_(str),\n      items_(items)\n    {\n    }\n\nIf I declare a variable of type `Foo` using the traditional syntax, it compiles fine:\n\n      Foo f(L\"Hello\", std::vector<std::wstring>());\n\nHowever, if I declare it using `auto`, then I get a compile error:\n\n      auto f2 = Foo { L\"Goodbye\", std::vector<std::wstring>() };\n\n> error C2280: 'Foo::Foo(const Foo &)': attempting to reference a deleted function  \n> note: compiler has generated 'Foo::Foo' here\n\nI understand that the copy constructor for `Foo` should be deleted, since `unique_ptr` can't be copied. However, it was my understanding that when declaring variables in this way, the result would be either moved into the variable or just set the value into the variable directly.\n\nThe second line compiles fine when using Visual Studio 2013. I checked the breaking changes in Visual Studio 2015, but I didn't see anything there that would indicate why this started failing.\n\nAm I doing something wrong, or can this syntax not be used with non-copyable types?") (share_link . "http://stackoverflow.com/q/34858457/692055") (question_id . 34858457) (last_edit_date . 1453131941) (creation_date . 1453131263) (last_activity_date . 1453131941) (score . 4) (answer_count . 2) (accepted_answer_id . 34858568) (view_count . 187) (is_answered . t) (upvoted) (downvoted) (last_editor (link . "http://stackoverflow.com/users/636019/ildjarn") (display_name . "ildjarn") (profile_image . "https://www.gravatar.com/avatar/38ba39c7ba510ac2951c010c26afb6a6?s=128&d=identicon&r=PG") (user_type . "registered") (user_id . 636019) (reputation . 42901)) (owner (link . "http://stackoverflow.com/users/3857/andy") (display_name . "Andy") (profile_image . "https://www.gravatar.com/avatar/21599de27f8bc6cc7e9b3d002addbca8?s=128&d=identicon&r=PG") (accept_rate . 100) (user_type . "registered") (user_id . 3857) (reputation . 18755)) (answers ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858538#34858538") (body_markdown . "Because the class contains a [`std::unique_ptr`](http://en.cppreference.com/w/cpp/memory/unique_ptr) member the compiler can't generate a copy-constructor like it would normally do, which means your declaration and initialization (which invokes the copy-constructor) will not be possible.\n\nYou could solve it by making a [move constructor](http://en.cppreference.com/w/cpp/language/move_constructor) for your class and mark it as `default`.") (share_link . "http://stackoverflow.com/a/34858538/692055") (question_id . 34858457) (answer_id . 34858538) (creation_date . 1453131440) (last_activity_date . 1453131440) (score . 5) (is_accepted) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/440558/joachim-pileborg") (display_name . "Joachim Pileborg") (profile_image . "https://i.stack.imgur.com/9ZYta.jpg?s=128&g=1") (accept_rate . 75) (user_type . "registered") (user_id . 440558) (reputation . 177029))) ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858568#34858568") (body_markdown . "The move constructor is not implicitly declared, because you have a user-declared destructor (see [[class.copy]/(9.4)][1]). However, the copy constructor is clearly deleted, since `unique_ptr` can't be copied.\n\nYou can explicitly declare the move constructor as defaulted.\n\n\n  [1]: http://eel.is/c++draft/class.copy#9") (share_link . "http://stackoverflow.com/a/34858568/692055") (question_id . 34858457) (answer_id . 34858568) (creation_date . 1453131565) (last_activity_date . 1453131565) (score . 10) (is_accepted . t) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/3647361/columbo") (display_name . "Columbo") (profile_image . "https://i.stack.imgur.com/xvjhM.png?s=128&g=1") (accept_rate . 83) (user_type . "registered") (user_id . 3647361) (reputation . 35995)))) (tags "c++" "c++11" "visual-c++" "visual-studio-2015" "move-semantics")))
  sx-question-mode--erase-and-print-question(((title . "Why can't I declare a variable using auto?") (site_par . "stackoverflow") (link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto") (body_markdown . "I'm getting a compile error in Visual Studio 2015 when I try to declare a variable of class, when that classes uses the PIMPL pattern.\n\nFoo.h:\n\n    #pragma once\n\n    class Foo\n    {\n    public:\n      Foo(const std::wstring& str,\n          const std::vector<std::wstring>& items);\n      ~Foo();\n\n    private:\n      struct Impl;\n      std::unique_ptr<Impl> pimpl;\n    };\n\nFoo.cpp:\n\n    #include \"stdafx.h\"\n    #include \"Foo.h\"\n\n    struct Foo::Impl\n    {\n    public:\n      Impl(const std::wstring& str,\n           const std::vector<std::wstring>& items);\n\n      std::wstring str_;\n      std::vector<std::wstring> items_;\n    };\n\n    Foo::Foo(const std::wstring& str,\n             const std::vector<std::wstring>& items)\n      : pimpl(std::make_unique<Impl>(str, items))\n    {\n    }\n\n    Foo::~Foo() = default;\n\n    Foo::Impl::Impl(const std::wstring& str,\n                    const std::vector<std::wstring>& items)\n      : str_(str),\n      items_(items)\n    {\n    }\n\nIf I declare a variable of type `Foo` using the traditional syntax, it compiles fine:\n\n      Foo f(L\"Hello\", std::vector<std::wstring>());\n\nHowever, if I declare it using `auto`, then I get a compile error:\n\n      auto f2 = Foo { L\"Goodbye\", std::vector<std::wstring>() };\n\n> error C2280: 'Foo::Foo(const Foo &)': attempting to reference a deleted function  \n> note: compiler has generated 'Foo::Foo' here\n\nI understand that the copy constructor for `Foo` should be deleted, since `unique_ptr` can't be copied. However, it was my understanding that when declaring variables in this way, the result would be either moved into the variable or just set the value into the variable directly.\n\nThe second line compiles fine when using Visual Studio 2013. I checked the breaking changes in Visual Studio 2015, but I didn't see anything there that would indicate why this started failing.\n\nAm I doing something wrong, or can this syntax not be used with non-copyable types?") (share_link . "http://stackoverflow.com/q/34858457/692055") (question_id . 34858457) (last_edit_date . 1453131941) (creation_date . 1453131263) (last_activity_date . 1453131941) (score . 4) (answer_count . 2) (accepted_answer_id . 34858568) (view_count . 187) (is_answered . t) (upvoted) (downvoted) (last_editor (link . "http://stackoverflow.com/users/636019/ildjarn") (display_name . "ildjarn") (profile_image . "https://www.gravatar.com/avatar/38ba39c7ba510ac2951c010c26afb6a6?s=128&d=identicon&r=PG") (user_type . "registered") (user_id . 636019) (reputation . 42901)) (owner (link . "http://stackoverflow.com/users/3857/andy") (display_name . "Andy") (profile_image . "https://www.gravatar.com/avatar/21599de27f8bc6cc7e9b3d002addbca8?s=128&d=identicon&r=PG") (accept_rate . 100) (user_type . "registered") (user_id . 3857) (reputation . 18755)) (answers ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858538#34858538") (body_markdown . "Because the class contains a [`std::unique_ptr`](http://en.cppreference.com/w/cpp/memory/unique_ptr) member the compiler can't generate a copy-constructor like it would normally do, which means your declaration and initialization (which invokes the copy-constructor) will not be possible.\n\nYou could solve it by making a [move constructor](http://en.cppreference.com/w/cpp/language/move_constructor) for your class and mark it as `default`.") (share_link . "http://stackoverflow.com/a/34858538/692055") (question_id . 34858457) (answer_id . 34858538) (creation_date . 1453131440) (last_activity_date . 1453131440) (score . 5) (is_accepted) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/440558/joachim-pileborg") (display_name . "Joachim Pileborg") (profile_image . "https://i.stack.imgur.com/9ZYta.jpg?s=128&g=1") (accept_rate . 75) (user_type . "registered") (user_id . 440558) (reputation . 177029))) ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858568#34858568") (body_markdown . "The move constructor is not implicitly declared, because you have a user-declared destructor (see [[class.copy]/(9.4)][1]). However, the copy constructor is clearly deleted, since `unique_ptr` can't be copied.\n\nYou can explicitly declare the move constructor as defaulted.\n\n\n  [1]: http://eel.is/c++draft/class.copy#9") (share_link . "http://stackoverflow.com/a/34858568/692055") (question_id . 34858457) (answer_id . 34858568) (creation_date . 1453131565) (last_activity_date . 1453131565) (score . 10) (is_accepted . t) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/3647361/columbo") (display_name . "Columbo") (profile_image . "https://i.stack.imgur.com/xvjhM.png?s=128&g=1") (accept_rate . 83) (user_type . "registered") (user_id . 3647361) (reputation . 35995)))) (tags "c++" "c++11" "visual-c++" "visual-studio-2015" "move-semantics")))
  sx-question-mode--display(((title . "Why can't I declare a variable using auto?") (site_par . "stackoverflow") (link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto") (body_markdown . "I'm getting a compile error in Visual Studio 2015 when I try to declare a variable of class, when that classes uses the PIMPL pattern.\n\nFoo.h:\n\n    #pragma once\n\n    class Foo\n    {\n    public:\n      Foo(const std::wstring& str,\n          const std::vector<std::wstring>& items);\n      ~Foo();\n\n    private:\n      struct Impl;\n      std::unique_ptr<Impl> pimpl;\n    };\n\nFoo.cpp:\n\n    #include \"stdafx.h\"\n    #include \"Foo.h\"\n\n    struct Foo::Impl\n    {\n    public:\n      Impl(const std::wstring& str,\n           const std::vector<std::wstring>& items);\n\n      std::wstring str_;\n      std::vector<std::wstring> items_;\n    };\n\n    Foo::Foo(const std::wstring& str,\n             const std::vector<std::wstring>& items)\n      : pimpl(std::make_unique<Impl>(str, items))\n    {\n    }\n\n    Foo::~Foo() = default;\n\n    Foo::Impl::Impl(const std::wstring& str,\n                    const std::vector<std::wstring>& items)\n      : str_(str),\n      items_(items)\n    {\n    }\n\nIf I declare a variable of type `Foo` using the traditional syntax, it compiles fine:\n\n      Foo f(L\"Hello\", std::vector<std::wstring>());\n\nHowever, if I declare it using `auto`, then I get a compile error:\n\n      auto f2 = Foo { L\"Goodbye\", std::vector<std::wstring>() };\n\n> error C2280: 'Foo::Foo(const Foo &)': attempting to reference a deleted function  \n> note: compiler has generated 'Foo::Foo' here\n\nI understand that the copy constructor for `Foo` should be deleted, since `unique_ptr` can't be copied. However, it was my understanding that when declaring variables in this way, the result would be either moved into the variable or just set the value into the variable directly.\n\nThe second line compiles fine when using Visual Studio 2013. I checked the breaking changes in Visual Studio 2015, but I didn't see anything there that would indicate why this started failing.\n\nAm I doing something wrong, or can this syntax not be used with non-copyable types?") (share_link . "http://stackoverflow.com/q/34858457/692055") (question_id . 34858457) (last_edit_date . 1453131941) (creation_date . 1453131263) (last_activity_date . 1453131941) (score . 4) (answer_count . 2) (accepted_answer_id . 34858568) (view_count . 187) (is_answered . t) (upvoted) (downvoted) (last_editor (link . "http://stackoverflow.com/users/636019/ildjarn") (display_name . "ildjarn") (profile_image . "https://www.gravatar.com/avatar/38ba39c7ba510ac2951c010c26afb6a6?s=128&d=identicon&r=PG") (user_type . "registered") (user_id . 636019) (reputation . 42901)) (owner (link . "http://stackoverflow.com/users/3857/andy") (display_name . "Andy") (profile_image . "https://www.gravatar.com/avatar/21599de27f8bc6cc7e9b3d002addbca8?s=128&d=identicon&r=PG") (accept_rate . 100) (user_type . "registered") (user_id . 3857) (reputation . 18755)) (answers ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858538#34858538") (body_markdown . "Because the class contains a [`std::unique_ptr`](http://en.cppreference.com/w/cpp/memory/unique_ptr) member the compiler can't generate a copy-constructor like it would normally do, which means your declaration and initialization (which invokes the copy-constructor) will not be possible.\n\nYou could solve it by making a [move constructor](http://en.cppreference.com/w/cpp/language/move_constructor) for your class and mark it as `default`.") (share_link . "http://stackoverflow.com/a/34858538/692055") (question_id . 34858457) (answer_id . 34858538) (creation_date . 1453131440) (last_activity_date . 1453131440) (score . 5) (is_accepted) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/440558/joachim-pileborg") (display_name . "Joachim Pileborg") (profile_image . "https://i.stack.imgur.com/9ZYta.jpg?s=128&g=1") (accept_rate . 75) (user_type . "registered") (user_id . 440558) (reputation . 177029))) ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858568#34858568") (body_markdown . "The move constructor is not implicitly declared, because you have a user-declared destructor (see [[class.copy]/(9.4)][1]). However, the copy constructor is clearly deleted, since `unique_ptr` can't be copied.\n\nYou can explicitly declare the move constructor as defaulted.\n\n\n  [1]: http://eel.is/c++draft/class.copy#9") (share_link . "http://stackoverflow.com/a/34858568/692055") (question_id . 34858457) (answer_id . 34858568) (creation_date . 1453131565) (last_activity_date . 1453131565) (score . 10) (is_accepted . t) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/3647361/columbo") (display_name . "Columbo") (profile_image . "https://i.stack.imgur.com/xvjhM.png?s=128&g=1") (accept_rate . 83) (user_type . "registered") (user_id . 3647361) (reputation . 35995)))) (tags "c++" "c++11" "visual-c++" "visual-studio-2015" "move-semantics")) nil)
  sx-display-question(((title . "Why can't I declare a variable using auto?") (site_par . "stackoverflow") (link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto") (body_markdown . "I'm getting a compile error in Visual Studio 2015 when I try to declare a variable of class, when that classes uses the PIMPL pattern.\n\nFoo.h:\n\n    #pragma once\n\n    class Foo\n    {\n    public:\n      Foo(const std::wstring& str,\n          const std::vector<std::wstring>& items);\n      ~Foo();\n\n    private:\n      struct Impl;\n      std::unique_ptr<Impl> pimpl;\n    };\n\nFoo.cpp:\n\n    #include \"stdafx.h\"\n    #include \"Foo.h\"\n\n    struct Foo::Impl\n    {\n    public:\n      Impl(const std::wstring& str,\n           const std::vector<std::wstring>& items);\n\n      std::wstring str_;\n      std::vector<std::wstring> items_;\n    };\n\n    Foo::Foo(const std::wstring& str,\n             const std::vector<std::wstring>& items)\n      : pimpl(std::make_unique<Impl>(str, items))\n    {\n    }\n\n    Foo::~Foo() = default;\n\n    Foo::Impl::Impl(const std::wstring& str,\n                    const std::vector<std::wstring>& items)\n      : str_(str),\n      items_(items)\n    {\n    }\n\nIf I declare a variable of type `Foo` using the traditional syntax, it compiles fine:\n\n      Foo f(L\"Hello\", std::vector<std::wstring>());\n\nHowever, if I declare it using `auto`, then I get a compile error:\n\n      auto f2 = Foo { L\"Goodbye\", std::vector<std::wstring>() };\n\n> error C2280: 'Foo::Foo(const Foo &)': attempting to reference a deleted function  \n> note: compiler has generated 'Foo::Foo' here\n\nI understand that the copy constructor for `Foo` should be deleted, since `unique_ptr` can't be copied. However, it was my understanding that when declaring variables in this way, the result would be either moved into the variable or just set the value into the variable directly.\n\nThe second line compiles fine when using Visual Studio 2013. I checked the breaking changes in Visual Studio 2015, but I didn't see anything there that would indicate why this started failing.\n\nAm I doing something wrong, or can this syntax not be used with non-copyable types?") (share_link . "http://stackoverflow.com/q/34858457/692055") (question_id . 34858457) (last_edit_date . 1453131941) (creation_date . 1453131263) (last_activity_date . 1453131941) (score . 4) (answer_count . 2) (accepted_answer_id . 34858568) (view_count . 187) (is_answered . t) (upvoted) (downvoted) (last_editor (link . "http://stackoverflow.com/users/636019/ildjarn") (display_name . "ildjarn") (profile_image . "https://www.gravatar.com/avatar/38ba39c7ba510ac2951c010c26afb6a6?s=128&d=identicon&r=PG") (user_type . "registered") (user_id . 636019) (reputation . 42901)) (owner (link . "http://stackoverflow.com/users/3857/andy") (display_name . "Andy") (profile_image . "https://www.gravatar.com/avatar/21599de27f8bc6cc7e9b3d002addbca8?s=128&d=identicon&r=PG") (accept_rate . 100) (user_type . "registered") (user_id . 3857) (reputation . 18755)) (answers ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858538#34858538") (body_markdown . "Because the class contains a [`std::unique_ptr`](http://en.cppreference.com/w/cpp/memory/unique_ptr) member the compiler can't generate a copy-constructor like it would normally do, which means your declaration and initialization (which invokes the copy-constructor) will not be possible.\n\nYou could solve it by making a [move constructor](http://en.cppreference.com/w/cpp/language/move_constructor) for your class and mark it as `default`.") (share_link . "http://stackoverflow.com/a/34858538/692055") (question_id . 34858457) (answer_id . 34858538) (creation_date . 1453131440) (last_activity_date . 1453131440) (score . 5) (is_accepted) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/440558/joachim-pileborg") (display_name . "Joachim Pileborg") (profile_image . "https://i.stack.imgur.com/9ZYta.jpg?s=128&g=1") (accept_rate . 75) (user_type . "registered") (user_id . 440558) (reputation . 177029))) ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858568#34858568") (body_markdown . "The move constructor is not implicitly declared, because you have a user-declared destructor (see [[class.copy]/(9.4)][1]). However, the copy constructor is clearly deleted, since `unique_ptr` can't be copied.\n\nYou can explicitly declare the move constructor as defaulted.\n\n\n  [1]: http://eel.is/c++draft/class.copy#9") (share_link . "http://stackoverflow.com/a/34858568/692055") (question_id . 34858457) (answer_id . 34858568) (creation_date . 1453131565) (last_activity_date . 1453131565) (score . 10) (is_accepted . t) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/3647361/columbo") (display_name . "Columbo") (profile_image . "https://i.stack.imgur.com/xvjhM.png?s=128&g=1") (accept_rate . 83) (user_type . "registered") (user_id . 3647361) (reputation . 35995)))) (tags "c++" "c++11" "visual-c++" "visual-studio-2015" "move-semantics")) focus)
  sx-display(((title . "Why can't I declare a variable using auto?") (site_par . "stackoverflow") (link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto") (body_markdown . "I'm getting a compile error in Visual Studio 2015 when I try to declare a variable of class, when that classes uses the PIMPL pattern.\n\nFoo.h:\n\n    #pragma once\n\n    class Foo\n    {\n    public:\n      Foo(const std::wstring& str,\n          const std::vector<std::wstring>& items);\n      ~Foo();\n\n    private:\n      struct Impl;\n      std::unique_ptr<Impl> pimpl;\n    };\n\nFoo.cpp:\n\n    #include \"stdafx.h\"\n    #include \"Foo.h\"\n\n    struct Foo::Impl\n    {\n    public:\n      Impl(const std::wstring& str,\n           const std::vector<std::wstring>& items);\n\n      std::wstring str_;\n      std::vector<std::wstring> items_;\n    };\n\n    Foo::Foo(const std::wstring& str,\n             const std::vector<std::wstring>& items)\n      : pimpl(std::make_unique<Impl>(str, items))\n    {\n    }\n\n    Foo::~Foo() = default;\n\n    Foo::Impl::Impl(const std::wstring& str,\n                    const std::vector<std::wstring>& items)\n      : str_(str),\n      items_(items)\n    {\n    }\n\nIf I declare a variable of type `Foo` using the traditional syntax, it compiles fine:\n\n      Foo f(L\"Hello\", std::vector<std::wstring>());\n\nHowever, if I declare it using `auto`, then I get a compile error:\n\n      auto f2 = Foo { L\"Goodbye\", std::vector<std::wstring>() };\n\n> error C2280: 'Foo::Foo(const Foo &)': attempting to reference a deleted function  \n> note: compiler has generated 'Foo::Foo' here\n\nI understand that the copy constructor for `Foo` should be deleted, since `unique_ptr` can't be copied. However, it was my understanding that when declaring variables in this way, the result would be either moved into the variable or just set the value into the variable directly.\n\nThe second line compiles fine when using Visual Studio 2013. I checked the breaking changes in Visual Studio 2015, but I didn't see anything there that would indicate why this started failing.\n\nAm I doing something wrong, or can this syntax not be used with non-copyable types?") (share_link . "http://stackoverflow.com/q/34858457/692055") (question_id . 34858457) (last_edit_date . 1453131941) (creation_date . 1453131263) (last_activity_date . 1453131941) (score . 4) (answer_count . 2) (accepted_answer_id . 34858568) (view_count . 187) (is_answered . t) (upvoted) (downvoted) (last_editor (link . "http://stackoverflow.com/users/636019/ildjarn") (display_name . "ildjarn") (profile_image . "https://www.gravatar.com/avatar/38ba39c7ba510ac2951c010c26afb6a6?s=128&d=identicon&r=PG") (user_type . "registered") (user_id . 636019) (reputation . 42901)) (owner (link . "http://stackoverflow.com/users/3857/andy") (display_name . "Andy") (profile_image . "https://www.gravatar.com/avatar/21599de27f8bc6cc7e9b3d002addbca8?s=128&d=identicon&r=PG") (accept_rate . 100) (user_type . "registered") (user_id . 3857) (reputation . 18755)) (answers ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858538#34858538") (body_markdown . "Because the class contains a [`std::unique_ptr`](http://en.cppreference.com/w/cpp/memory/unique_ptr) member the compiler can't generate a copy-constructor like it would normally do, which means your declaration and initialization (which invokes the copy-constructor) will not be possible.\n\nYou could solve it by making a [move constructor](http://en.cppreference.com/w/cpp/language/move_constructor) for your class and mark it as `default`.") (share_link . "http://stackoverflow.com/a/34858538/692055") (question_id . 34858457) (answer_id . 34858538) (creation_date . 1453131440) (last_activity_date . 1453131440) (score . 5) (is_accepted) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/440558/joachim-pileborg") (display_name . "Joachim Pileborg") (profile_image . "https://i.stack.imgur.com/9ZYta.jpg?s=128&g=1") (accept_rate . 75) (user_type . "registered") (user_id . 440558) (reputation . 177029))) ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858568#34858568") (body_markdown . "The move constructor is not implicitly declared, because you have a user-declared destructor (see [[class.copy]/(9.4)][1]). However, the copy constructor is clearly deleted, since `unique_ptr` can't be copied.\n\nYou can explicitly declare the move constructor as defaulted.\n\n\n  [1]: http://eel.is/c++draft/class.copy#9") (share_link . "http://stackoverflow.com/a/34858568/692055") (question_id . 34858457) (answer_id . 34858568) (creation_date . 1453131565) (last_activity_date . 1453131565) (score . 10) (is_accepted . t) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/3647361/columbo") (display_name . "Columbo") (profile_image . "https://i.stack.imgur.com/xvjhM.png?s=128&g=1") (accept_rate . 83) (user_type . "registered") (user_id . 3647361) (reputation . 35995)))) (tags "c++" "c++11" "visual-c++" "visual-studio-2015" "move-semantics")))
  funcall-interactively(sx-display ((title . "Why can't I declare a variable using auto?") (site_par . "stackoverflow") (link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto") (body_markdown . "I'm getting a compile error in Visual Studio 2015 when I try to declare a variable of class, when that classes uses the PIMPL pattern.\n\nFoo.h:\n\n    #pragma once\n\n    class Foo\n    {\n    public:\n      Foo(const std::wstring& str,\n          const std::vector<std::wstring>& items);\n      ~Foo();\n\n    private:\n      struct Impl;\n      std::unique_ptr<Impl> pimpl;\n    };\n\nFoo.cpp:\n\n    #include \"stdafx.h\"\n    #include \"Foo.h\"\n\n    struct Foo::Impl\n    {\n    public:\n      Impl(const std::wstring& str,\n           const std::vector<std::wstring>& items);\n\n      std::wstring str_;\n      std::vector<std::wstring> items_;\n    };\n\n    Foo::Foo(const std::wstring& str,\n             const std::vector<std::wstring>& items)\n      : pimpl(std::make_unique<Impl>(str, items))\n    {\n    }\n\n    Foo::~Foo() = default;\n\n    Foo::Impl::Impl(const std::wstring& str,\n                    const std::vector<std::wstring>& items)\n      : str_(str),\n      items_(items)\n    {\n    }\n\nIf I declare a variable of type `Foo` using the traditional syntax, it compiles fine:\n\n      Foo f(L\"Hello\", std::vector<std::wstring>());\n\nHowever, if I declare it using `auto`, then I get a compile error:\n\n      auto f2 = Foo { L\"Goodbye\", std::vector<std::wstring>() };\n\n> error C2280: 'Foo::Foo(const Foo &)': attempting to reference a deleted function  \n> note: compiler has generated 'Foo::Foo' here\n\nI understand that the copy constructor for `Foo` should be deleted, since `unique_ptr` can't be copied. However, it was my understanding that when declaring variables in this way, the result would be either moved into the variable or just set the value into the variable directly.\n\nThe second line compiles fine when using Visual Studio 2013. I checked the breaking changes in Visual Studio 2015, but I didn't see anything there that would indicate why this started failing.\n\nAm I doing something wrong, or can this syntax not be used with non-copyable types?") (share_link . "http://stackoverflow.com/q/34858457/692055") (question_id . 34858457) (last_edit_date . 1453131941) (creation_date . 1453131263) (last_activity_date . 1453131941) (score . 4) (answer_count . 2) (accepted_answer_id . 34858568) (view_count . 187) (is_answered . t) (upvoted) (downvoted) (last_editor (link . "http://stackoverflow.com/users/636019/ildjarn") (display_name . "ildjarn") (profile_image . "https://www.gravatar.com/avatar/38ba39c7ba510ac2951c010c26afb6a6?s=128&d=identicon&r=PG") (user_type . "registered") (user_id . 636019) (reputation . 42901)) (owner (link . "http://stackoverflow.com/users/3857/andy") (display_name . "Andy") (profile_image . "https://www.gravatar.com/avatar/21599de27f8bc6cc7e9b3d002addbca8?s=128&d=identicon&r=PG") (accept_rate . 100) (user_type . "registered") (user_id . 3857) (reputation . 18755)) (answers ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858538#34858538") (body_markdown . "Because the class contains a [`std::unique_ptr`](http://en.cppreference.com/w/cpp/memory/unique_ptr) member the compiler can't generate a copy-constructor like it would normally do, which means your declaration and initialization (which invokes the copy-constructor) will not be possible.\n\nYou could solve it by making a [move constructor](http://en.cppreference.com/w/cpp/language/move_constructor) for your class and mark it as `default`.") (share_link . "http://stackoverflow.com/a/34858538/692055") (question_id . 34858457) (answer_id . 34858538) (creation_date . 1453131440) (last_activity_date . 1453131440) (score . 5) (is_accepted) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/440558/joachim-pileborg") (display_name . "Joachim Pileborg") (profile_image . "https://i.stack.imgur.com/9ZYta.jpg?s=128&g=1") (accept_rate . 75) (user_type . "registered") (user_id . 440558) (reputation . 177029))) ((link . "http://stackoverflow.com/questions/34858457/why-cant-i-declare-a-variable-using-auto/34858568#34858568") (body_markdown . "The move constructor is not implicitly declared, because you have a user-declared destructor (see [[class.copy]/(9.4)][1]). However, the copy constructor is clearly deleted, since `unique_ptr` can't be copied.\n\nYou can explicitly declare the move constructor as defaulted.\n\n\n  [1]: http://eel.is/c++draft/class.copy#9") (share_link . "http://stackoverflow.com/a/34858568/692055") (question_id . 34858457) (answer_id . 34858568) (creation_date . 1453131565) (last_activity_date . 1453131565) (score . 10) (is_accepted . t) (upvoted) (downvoted) (owner (link . "http://stackoverflow.com/users/3647361/columbo") (display_name . "Columbo") (profile_image . "https://i.stack.imgur.com/xvjhM.png?s=128&g=1") (accept_rate . 83) (user_type . "registered") (user_id . 3647361) (reputation . 35995)))) (tags "c++" "c++11" "visual-c++" "visual-studio-2015" "move-semantics")))
  call-interactively(sx-display nil nil)
  command-execute(sx-display)
ngquerol commented 8 years ago

It's working now :) Seems like @Malabarba resolved the issue via @ 71a4cc7590a0bb5521361992f03bb466b033604c.

Malabarba commented 8 years ago

Should be fixed after fbdfff2. Let me know if it works.

manuel-uberti commented 8 years ago

Yes, it is working for me. Thank you.