[Bug c++/52126] New: compilation error

2012-02-05 Thread tmmikolajczyk at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52126

 Bug #: 52126
   Summary: compilation error
Classification: Unclassified
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: tmmikolajc...@gmail.com


I encountered a compilation error when compiling the following code:

template
class A
{
public:
void foo() {};

class B : private A
{
public:
typedef A inherited;
using inherited::foo;
};
};

The code seems to be valid. Compilation output (the gcc_47_error.cpp file is
attached):
$ g++ --version
g++ (GCC) 4.7.0 20120205 (experimental)
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ g++ gcc_47_error.cpp
gcc_47_error.cpp:12:26: error: no members matching ‘A::B::inherited::foo’ in
‘A::B::inherited’

It compiles fine with gcc 4.6.2 and clang.
I'm using gcc built manually based on revision 183914.

My OS: Arch Linux:
$ uname -a
Linux alligator 3.2.2-1-ARCH #1 SMP PREEMPT Thu Jan 26 08:28:27 UTC 2012 i686
Intel(R) Pentium(R) 4 CPU 2.40GHz GenuineIntel GNU/Linux


[Bug c++/52126] [4.7 Regression] compilation error

2012-02-05 Thread tmmikolajczyk at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52126

--- Comment #2 from tmmikolajczyk at gmail dot com 2012-02-05 20:57:29 UTC ---
Further investigation shows that the issue appears only when inheritance from
the template class (class B : private A) is provided explicitly. According
to the standard a nested class defined inside a class template is implicitly
template as well. The modified code reflecting that rule compiles fine:

template
class A
{
public:
void foo() {};

class B : private A
{
public:
typedef A inherited;
using inherited::foo;
};
};

Anyway, the first version of the code seems to be valid C++ code.


[Bug c++/59144] New: weird behavior when dealing with too complicated templates and class hierarchy

2013-11-14 Thread tmmikolajczyk at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59144

Bug ID: 59144
   Summary: weird behavior when dealing with too complicated
templates and class hierarchy
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tmmikolajczyk at gmail dot com

gcc 4.8.2
linux x86_64

Please consider the following code:

class Base
{
public:
virtual ~Base() {}
protected:
void foo() const {}
};

template
class CRTP : protected virtual T {};

template
class X : protected virtual CRTP
{
public:
virtual void bar(const Base& inst) const
{
inst.foo();
}
};

template
class Y: protected virtual CRTP {};

class Z : private Y, public X {};

int main(int, char**)
{
Z z;
return 0;
}

Both gcc and clang rejects this code complaining that:
$ g++ main.cpp 
main.cpp: In instantiation of 'void X::bar(const Base&) const [with T =
Z; U = Base]':
main.cpp:32:1:   required from here
main.cpp:7:10: error: 'void Base::foo() const' is protected
 void foo() const {}
  ^
main.cpp:19:18: error: within this context
 inst.foo();
  ^

However when making the "X::bar" method non-virtual:

void bar(const Base& inst) const

The compilation passes (on gcc and clang). It's quite weird that the virtualism
of the "X::bar" method has such an impact.

Please also consider the following sligthly modified "X::bar" method:

virtual void bar(const T& inst) const

Gcc silently accepts such code. but clang rejects it:

$ clang++ main.cpp 
main.cpp:19:14: error: 'foo' is a private member of 'Base'
inst.foo();
 ^
main.cpp:26:7: note: in instantiation of member function 'X::bar'
requested here
class Z : private Y, public X {};
  ^
main.cpp:26:11: note: constrained by private inheritance here
class Z : private Y, public X {};
  ^~~
main.cpp:7:10: note: member is declared here
void foo() const {}
 ^
main.cpp:19:9: error: cannot cast 'const Z' to its private base class 'const
Base'
inst.foo();
^
main.cpp:26:11: note: constrained by private inheritance here
class Z : private Y, public X {};
  ^~~
2 errors generated.
$


[Bug c++/59144] weird behavior when dealing with too complicated templates and class hierarchy

2013-11-16 Thread tmmikolajczyk at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59144

--- Comment #3 from tmmikolajczyk at gmail dot com ---
(In reply to Jonathan Wakely from comment #1)
> (In reply to tmmikolajczyk from comment #0)
> > The compilation passes (on gcc and clang). It's quite weird that the
> > virtualism of the "X::bar" method has such an impact.
> 
> But that doesn't make it a bug.

Why that's not a bug? No matter if the X::bar method is virtual or not it
should not have any impact on access to it from the derived classes in this
case IMHO.


[Bug libstdc++/59283] New: missing std::basic_string constructor

2013-11-25 Thread tmmikolajczyk at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59283

Bug ID: 59283
   Summary: missing std::basic_string constructor
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: libstdc++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: tmmikolajczyk at gmail dot com

The C++11 standard specifies the following c-tor in the std::basic_string
class:

basic_string (const basic_string&, const allocator_type&);

It looks like the c-tor is missing in the current libstdc++ implementation.