[Bug c++/92918] New: Does not do name lookup when using from base class

2019-12-11 Thread CoachHagins at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92918

Bug ID: 92918
   Summary: Does not do name lookup when using from base class
   Product: gcc
   Version: 9.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: CoachHagins at gmail dot com
  Target Milestone: ---

This bug exists on all versions of the compiler I tried, including the current
branch.

Here is a link to compiler explorer with the code example:
https://godbolt.org/z/wYo-4n

And here is a copy/paste of the code.  Compile with "-std=c++17 -DSHOW_BUG"

It shows several similar cases where the code compiles, followed by the case
which does not compile.

-


#include 

class ThisCompilesOnGCC {
static void impl(char const *);
public:
template 
[[nodiscard]] constexpr auto operator()(const T &t) const noexcept
-> decltype(impl(t))
{
return impl(t);
}
};
void thisCompilesOnGCC() {
ThisCompilesOnGCC{}("42");
}

class Base01 {
protected:
static void impl(char const *);
};
class ThisAlsoCompilesOnGCC : private Base01 {
using Base01::impl;
public:
template 
[[nodiscard]] constexpr auto operator()(const T &t) const noexcept
-> decltype(impl(t))
{
return impl(t);
}
};
void thisAlsoCompilesOnGCC() {
ThisAlsoCompilesOnGCC{}("42");
}

class Base02 {
protected:
static void impl(char const *);
};
class ThisCompilesOnGCCToo : private Base02 {
using Base02::impl;
static void impl(int);
public:
template 
[[nodiscard]] constexpr auto operator()(const T &t) const noexcept
-> decltype(impl(t))
{
return impl(t);
}
};
void thisCompilesOnGCCToo() {
ThisCompilesOnGCCToo{}("42");
}

#if defined (__clang__) || defined(SHOW_BUG)
// This compiles with clang - but not with gcc
class Base03 {
protected:
static void impl(int);
};
class ThisDoesNotCompileOnGCC : private Base03 {
using Base03::impl;
static void impl(char const *);
public:
template 
[[nodiscard]] constexpr auto operator()(const T &t) const noexcept
-> decltype(impl(t))
{
return impl(t);
}
};
void thisDoesNotCompileOnGCC() {
ThisDoesNotCompileOnGCC{}("42");
}
#endif

[Bug c++/69958] New: sizeof... computes wrong size

2016-02-25 Thread CoachHagins at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69958

Bug ID: 69958
   Summary: sizeof... computes wrong size
   Product: gcc
   Version: 5.3.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: CoachHagins at gmail dot com
  Target Milestone: ---

When sizeof...() is used in a wrapped context, it computes the incorrect size.

This is evident when using std::index_sequence_for, but I think it's a language
problem and not a library problem because I can reproduce the same mal-behavior
without involving the standard library.

I get the same behavior in 5.2 and 5.3; -std=c++14

See the following code example.


template 
struct list { };

template 
struct size {  };

template 
using size_for = size;


template 
using plain = size_for;

// This assertion passes
static_assert(std::is_same<
size<5>,
plain>::value, "");


template 
using plain2 = size_for;

// This assertion passes
static_assert(std::is_same<
size<5>,
plain2>::value, "");


template 
using wrapped = list>;

// This assertion fails (produces size<4>)
static_assert(std::is_same<
list>,
wrapped>::value, "");


template 
using wrapped2 = list>;

// This assertion fails (produces size<2>)
static_assert(std::is_same<
list>,
wrapped2>::value, "");

[Bug c++/108347] New: Incorrect error: ambiguous template instantiation

2023-01-09 Thread CoachHagins at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108347

Bug ID: 108347
   Summary: Incorrect error: ambiguous template instantiation
   Product: gcc
   Version: 13.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: CoachHagins at gmail dot com
  Target Milestone: ---

Created attachment 54222
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54222&action=edit
C++ source - no include directives

The attached code is a single .cpp file, as it contains no #include directives.

I have also posted on compiler explorer here: https://godbolt.org/z/jjEPKdx8Y

The code compiles fine with all versions of clang from 7 up through the latest
branch on CE.

The code FAILS to compile with gcc, all versions from 7 up through the latest
branch on CE.

There are THREE #defines in the included code, which provide three different
"fixes" to make the code compile.

The command

g++ -std=c++17 -DFIX0=0 -DFIX1=0 -DFIX2=0

will fail to compile with an ambiguous template instantiation error.  However,
all of the following will allow the code to compile.  Hopefully, the various
"fixes" will help identify the underlying issue(s).

g++ -std=c++17 -DFIX0=0 -DFIX1=0 -DFIX2=1
g++ -std=c++17 -DFIX0=0 -DFIX1=1 -DFIX2=0
g++ -std=c++17 -DFIX0=0 -DFIX1=1 -DFIX2=1
g++ -std=c++17 -DFIX0=1 -DFIX1=0 -DFIX2=0
g++ -std=c++17 -DFIX0=1 -DFIX1=0 -DFIX2=1
g++ -std=c++17 -DFIX0=1 -DFIX1=1 -DFIX2=0
g++ -std=c++17 -DFIX0=1 -DFIX1=1 -DFIX2=1