[Bug c++/83445] New: conversion function has too high priority in overload resolution

2017-12-16 Thread omawarisan.bokudesu at live dot jp
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83445

Bug ID: 83445
   Summary: conversion function has too high priority in overload
resolution
   Product: gcc
   Version: 7.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: omawarisan.bokudesu at live dot jp
  Target Milestone: ---

In the following program, overload resolution in the
direct-initialization of `target` from `source` (in the main function)
should select `Target(Source const&)` directly,
but gcc 7.2.0 and trunk with -std=c++17 uses `Source::operator Target()` .
I believe the former should be selected because a standard conversion sequence
is always better than a user-defined conversion sequence.

command: g++ test.cpp -std=c++17 -pedantic test.cpp
expected behavior: prints "OK"
actual behavior: prints "Bad"

#include 

struct Source;

struct Target
{
Target() = default;
Target(Source const&){
std::printf("OK\n");
value = 0;
}

int value = -1;
};

struct Source
{
operator Target(){
std::printf("Bad\n");
Target target;
target.value = 1;
return target;
}
};

int main()
{
Source source;
Target target{source};
std::printf("v = %d\n", target.value);
}


Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/data2/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/8.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /data2/gcc-trunk/gcc/configure --prefix=/data2/gcc-trunk
--enable-languages=c,c++ --disable-multilib
Thread model: posix
gcc version 8.0.0 20171215 (experimental) (GCC)

[Bug c++/57005] New: alias template's pseudo-destructor is rejected

2013-04-19 Thread omawarisan.bokudesu at live dot jp


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57005



 Bug #: 57005

   Summary: alias template's pseudo-destructor is rejected

Classification: Unclassified

   Product: gcc

   Version: 4.9.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: omawarisan.bokud...@live.jp





g++ -std=c++11 does not allow the following pseudo-destructor call.



template class T

using type = T;



int main()

{

typeint().~typeint();

}





Using built-in specs.

COLLECT_GCC=g++

COLLECT_LTO_WRAPPER=/home/user/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper

Target: x86_64-unknown-linux-gnu

Configured with: ../gcc/configure --prefix=/home/user/gcc-trunk

--disable-bootstrap --disable-multilib --enable-languages=c,c++,fortran

--with-gmp=/home/user/gcc-trunk/src/build/backends

--with-mpfr=/home/user/gcc-trunk/src/build/backends

--with-mpc=/home/user/gcc-trunk/src/build/backends

Thread model: posix

gcc version 4.9.0 20130419 (experimental) (GCC)


[Bug c++/56388] New: catch(...) in lambda rejected

2013-02-18 Thread omawarisan.bokudesu at live dot jp


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56388



 Bug #: 56388

   Summary: catch(...) in lambda rejected

Classification: Unclassified

   Product: gcc

   Version: 4.8.0

Status: UNCONFIRMED

  Severity: normal

  Priority: P3

 Component: c++

AssignedTo: unassig...@gcc.gnu.org

ReportedBy: omawarisan.bokud...@live.jp





g++ -std=c++11 rejects the following program:



int main()

{

bool /*const*/ condition = false;



[]{

try{}

catch(...){

if(condition){}

}

}();

}



If the condition variable is const, the compilation successes.



Using built-in specs.

COLLECT_GCC=g++

COLLECT_LTO_WRAPPER=/home/user/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper

Target: x86_64-unknown-linux-gnu

Configured with: ../gcc/configure --prefix=/home/user/gcc-trunk

--disable-bootstrap --disable-multilib --enable-languages=c,c++,fortran

--with-gmp=/home/user/gcc-trunk/src/build/backends

--with-mpfr=/home/user/gcc-trunk/src/build/backends

--with-mpc=/home/user/gcc-trunk/src/build/backends

Thread model: posix

gcc version 4.8.0 20130219 (experimental) (GCC)


[Bug c++/53484] New: [c++11] Wrong auto in lambdas in function templates

2012-05-25 Thread omawarisan.bokudesu at live dot jp
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53484

 Bug #: 53484
   Summary: [c++11] Wrong auto in lambdas in function templates
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: omawarisan.bokud...@live.jp


In the following program, auto is deduced to be int, while int is expected.

template class T
void f(T x){
   []{
   std::cout  x  std::endl;
   auto y = x;
   y = 100;
   std::cout  x  std::endl;
   }();
}

int main(){ f(0); }

output:
0
100

In non-template functions, it doesn't occur.


revision r187865

Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/user/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/home/user/gcc-trunk
--disable-bootstrap --disable-multilib --enable-languages=c,c++,fortran
--with-gmp=/home/user/gcc-trunk/src/build/backends
--with-mpfr=/home/user/gcc-trunk/src/build/backends
--with-mpc=/home/user/gcc-trunk/src/build/backends
Thread model: posix
gcc version 4.8.0 20120525 (experimental) (GCC)