[Bug c++/81486] Class template argument deduction fails with (), succeeds with {}

2019-01-02 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81486

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #6 from Marek Polacek  ---
Done.

[Bug c++/81486] Class template argument deduction fails with (), succeeds with {}

2019-01-02 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81486

--- Comment #5 from Marek Polacek  ---
Author: mpolacek
Date: Wed Jan  2 22:39:16 2019
New Revision: 267535

URL: https://gcc.gnu.org/viewcvs?rev=267535=gcc=rev
Log:
PR c++/81486 - CTAD failing with ().
* g++.dg/cpp1z/class-deduction60.C: New test.
* g++.dg/cpp1z/class-deduction61.C: New test.

Added:
trunk/gcc/testsuite/g++.dg/cpp1z/class-deduction60.C
trunk/gcc/testsuite/g++.dg/cpp1z/class-deduction61.C
Modified:
trunk/gcc/testsuite/ChangeLog

[Bug c++/81486] Class template argument deduction fails with (), succeeds with {}

2019-01-02 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81486

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |ASSIGNED
   Last reconfirmed||2019-01-02
 CC||mpolacek at gcc dot gnu.org
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org
 Ever confirmed|0   |1

--- Comment #4 from Marek Polacek  ---
The examples now compile with my patch for PR 88631.  I'll add them to the
testsuite.  Thanks for reporting them.

[Bug c++/81486] Class template argument deduction fails with (), succeeds with {}

2018-11-02 Thread ted at lyncon dot se
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81486

Ted Lyngmo  changed:

   What|Removed |Added

 CC||ted at lyncon dot se

--- Comment #3 from Ted Lyngmo  ---
A comparison between g++ 8.2 and clang++ 6.0.1

g++ -fsanitize=undefined -std=c++17 -Wall -Wextra -Wshadow -Weffc++ -pedantic
-pedantic-errors -Wc++14-compat -Wc++17-compat -c test.cpp
clang++ -fsanitize=undefined -std=c++17 -Wall -Wextra -Wshadow -Weffc++
-pedantic -pedantic-errors -Wc++14-compat -Wc++17-compat -c test.cpp

#include 

std::less lt_g;
std::greater gt_g;
// ok in g++ 8.2
// clang++ 6.0.1:
//  error: declaration of variable 'lt' with deduced type 'std::less' requires
an initializer
//  error: declaration of variable 'gt' with deduced type 'std::greater'
requires an initializer

auto lt_c = std::less();
auto gt_c = std::greater();
// ok in clang++ 6.0.1
// g++ 8.2:
//  error: cannot deduce template arguments for ‘less’ from ()
//  error: cannot deduce template arguments for ‘greater’ from ()

auto lt_b = std::less{};
auto gt_b = std::greater{};
// ok in both

[Bug c++/81486] Class template argument deduction fails with (), succeeds with {}

2017-11-11 Thread vittorio.romeo at outlook dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81486

--- Comment #2 from Vittorio Romeo  ---
Here's a snippet that seems to reproduce this bug, even without an explicit
deduction guide:

template 
struct foo
{
template 
foo(Us...) { }
};

int main()
{
auto f = foo();
}

On godbolt:
https://godbolt.org/g/CgqLq5

[Bug c++/81486] Class template argument deduction fails with (), succeeds with {}

2017-08-11 Thread benni.buch at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81486

Benjamin Buch  changed:

   What|Removed |Added

 CC||benni.buch at gmail dot com

--- Comment #1 from Benjamin Buch  ---
I did run into the same problem.