[Bug c++/95626] [concepts] incorrect ambiguous overload with constraints "A && !B" vs "!B"

2020-06-11 Thread godeffroy.valet at m4x dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95626

--- Comment #2 from Godeffroy Valet  ---
Oh, ok, thank you for the information. Strange rule...

[Bug c++/95626] New: [concepts] incorrect ambiguous overload with constraints "A && !B" vs "!B"

2020-06-10 Thread godeffroy.valet at m4x dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95626

Bug ID: 95626
   Summary: [concepts] incorrect ambiguous overload with
constraints "A && !B" vs "!B"
   Product: gcc
   Version: 10.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
      Reporter: godeffroy.valet at m4x dot org
  Target Milestone: ---

Created attachment 48715
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48715=edit
preprocessed source code

The following code fails to compile, giving an "ambiguous overload" error while
one function is clrearly more constrined than the other.


#include
template concept ConceptA=std::is_same::value;
template concept ConceptB=std::is_same::value;

template
requires (!ConceptB && ConceptA)
auto constexpr test__(A const& ){
}

template
requires (!ConceptB)
auto constexpr test__(A const& ){
}

int main(){
test__(2); // error
}


Note that the negation in "!ConceptB" is required to reproduced the issue.
In particular, the following code compiles.


#include
template concept ConceptA=std::is_same::value;
template concept ConceptB=!std::is_same::value;

template
requires (ConceptB && ConceptA)
auto constexpr test__(A const& ){
}

template
requires (ConceptB)
auto constexpr test__(A const& ){
}

int main(){
test__(2); // OK
}


Command used : g++ -std=c++2a -Wall -Wextra test.cpp
Output :
geometry/algebra/definition.test.cpp: In function 'int main()':
geometry/algebra/definition.test.cpp:23:10: error: call of overloaded
'test__(int)' is ambiguous
   23 |  test__(2);
  |  ^
geometry/algebra/definition.test.cpp:10:17: note: candidate: 'constexpr auto
test__(const A&) [with A = int]'
   10 |  auto constexpr test__(A const& ){
  | ^~
geometry/algebra/definition.test.cpp:14:17: note: candidate: 'constexpr auto
test__(const A&) [with A = int]'
   14 |  auto constexpr test__(A const& ){
  | ^~

Output of gcc -v :
Utilisation des specs internes.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/10.1.0/lto-wrapper
Cible : x86_64-pc-linux-gnu
Configuré avec: /build/gcc/src/gcc/configure --prefix=/usr --libdir=/usr/lib
--libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --with-isl
--with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit
--enable-cet=auto --enable-checking=release --enable-clocale=gnu
--enable-default-pie --enable-default-ssp --enable-gnu-indirect-function
--enable-gnu-unique-object --enable-install-libiberty --enable-linker-build-id
--enable-lto --enable-multilib --enable-plugin --enable-shared
--enable-threads=posix --disable-libssp --disable-libstdcxx-pch
--disable-libunwind-exceptions --disable-werror
gdc_include_dir=/usr/include/dlang/gdc
Modèle de thread: posix
Algorithmes de compression LTO supportés: zlib zstd
gcc version 10.1.0 (GCC)

[Bug c++/67070] [concepts] Concept with negation and disjunction not checked correctly

2019-03-19 Thread godeffroy.valet at m4x dot org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67070

Godeffroy Valet  changed:

   What|Removed |Added

 CC||godeffroy.valet at m4x dot org

--- Comment #10 from Godeffroy Valet  ---
I confirm that I get different result using the constraint !(C && C) or
using (!C || !C), which is quite unexpected. I have "g++ (Debian
8.2.0-14)".