public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/60878] New: Explicit Specialization of Inner Template Class In A Template Class, Using an Enum in Parent Template Class as Template Argument
@ 2014-04-17 22:17 fasdfasdas at gmail dot com
2014-04-17 22:17 ` [Bug c++/60878] " fasdfasdas at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: fasdfasdas at gmail dot com @ 2014-04-17 22:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60878
Bug ID: 60878
Summary: Explicit Specialization of Inner Template Class In A
Template Class, Using an Enum in Parent Template Class
as Template Argument
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fasdfasdas at gmail dot com
The following code compiles in clang++ 3.5 (as of yesterday's unstable branch)
and g++ 4.6.3. It does not compile with clang++ 2.9. It also compiles on "GNU
C++ (GCC) version 4.8.2 20140206 (prerelease) (x86_64-unknown-linux-gnu)" but
not "GNU C++ (Arch Repository) version 4.8.2 (arm-none-eabi)".
The compilers that do not compile the code gives an error saying:
test.cpp: In function 'int main()':
test.cpp:60:7: error: 'class Port<0u>::Pin<5u, (Port<0u>::PinMode)1>' has no
member named 'set'
pin.set();
^
Apparently, they do choose the class template, not the specialization.
Code to reproduce:
#include <cstdint>
template<std::size_t port>
class Port
{
public: //Declarations
enum class PinMode
{
Input = 0x0,
Output = 0x1,
Alternate = 0x2,
Analog = 0x3
};
template<uint8_t nPin, PinMode mode>
class Pin
{
};
template<uint8_t nPin>
class Pin<nPin, PinMode::Output>
{
public: //Declarations
enum class OutputSpeed : uint32_t
{
Low,
Medium,
Fast,
High
};
enum class PullMode : uint32_t
{
None = 0x0,
PullUp = 0x1,
PullDown = 0x2
};
public: //Methods
void setOutputSpeed(OutputSpeed const ospeed) volatile;
void setPullMode(PullMode const ppm) volatile;
void set() volatile
{
reinterpret_cast<Port<port> volatile*>(port)->m_BSRR |=
static_cast<uint16_t>(0x1) <<nPin;
}
void reset() volatile;
bool getOutputState() volatile;
}; //END OutputPin
public: //Registers
uint32_t m_BSRR;
}; //END Port
int main()
{
auto pin = Port<0>::Pin<5, Port<0>::PinMode::Output>();
pin.set();
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/60878] Explicit Specialization of Inner Template Class In A Template Class, Using an Enum in Parent Template Class as Template Argument
2014-04-17 22:17 [Bug c++/60878] New: Explicit Specialization of Inner Template Class In A Template Class, Using an Enum in Parent Template Class as Template Argument fasdfasdas at gmail dot com
@ 2014-04-17 22:17 ` fasdfasdas at gmail dot com
2014-04-17 22:31 ` [Bug c++/60878] Explicit Specialization of Inner Template Class In A Template Class, Using an Enum class " pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: fasdfasdas at gmail dot com @ 2014-04-17 22:17 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60878
Tolga <fasdfasdas at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |blocker
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/60878] Explicit Specialization of Inner Template Class In A Template Class, Using an Enum class in Parent Template Class as Template Argument
2014-04-17 22:17 [Bug c++/60878] New: Explicit Specialization of Inner Template Class In A Template Class, Using an Enum in Parent Template Class as Template Argument fasdfasdas at gmail dot com
2014-04-17 22:17 ` [Bug c++/60878] " fasdfasdas at gmail dot com
@ 2014-04-17 22:31 ` pinskia at gcc dot gnu.org
2014-04-18 0:10 ` redi at gcc dot gnu.org
2014-06-06 9:30 ` paolo.carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-04-17 22:31 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60878
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Explicit Specialization of |Explicit Specialization of
|Inner Template Class In A |Inner Template Class In A
|Template Class, Using an |Template Class, Using an
|Enum in Parent Template |Enum class in Parent
|Class as Template Argument |Template Class as Template
| |Argument
Severity|blocker |normal
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/60878] Explicit Specialization of Inner Template Class In A Template Class, Using an Enum class in Parent Template Class as Template Argument
2014-04-17 22:17 [Bug c++/60878] New: Explicit Specialization of Inner Template Class In A Template Class, Using an Enum in Parent Template Class as Template Argument fasdfasdas at gmail dot com
2014-04-17 22:17 ` [Bug c++/60878] " fasdfasdas at gmail dot com
2014-04-17 22:31 ` [Bug c++/60878] Explicit Specialization of Inner Template Class In A Template Class, Using an Enum class " pinskia at gcc dot gnu.org
@ 2014-04-18 0:10 ` redi at gcc dot gnu.org
2014-06-06 9:30 ` paolo.carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2014-04-18 0:10 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60878
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Known to work| |4.10.0, 4.7.3, 4.9.0
--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Already fixed in the 4.9 branch and trunk
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/60878] Explicit Specialization of Inner Template Class In A Template Class, Using an Enum class in Parent Template Class as Template Argument
2014-04-17 22:17 [Bug c++/60878] New: Explicit Specialization of Inner Template Class In A Template Class, Using an Enum in Parent Template Class as Template Argument fasdfasdas at gmail dot com
` (2 preceding siblings ...)
2014-04-18 0:10 ` redi at gcc dot gnu.org
@ 2014-06-06 9:30 ` paolo.carlini at oracle dot com
3 siblings, 0 replies; 5+ messages in thread
From: paolo.carlini at oracle dot com @ 2014-06-06 9:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60878
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> ---
Closing.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-06-06 9:30 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-17 22:17 [Bug c++/60878] New: Explicit Specialization of Inner Template Class In A Template Class, Using an Enum in Parent Template Class as Template Argument fasdfasdas at gmail dot com
2014-04-17 22:17 ` [Bug c++/60878] " fasdfasdas at gmail dot com
2014-04-17 22:31 ` [Bug c++/60878] Explicit Specialization of Inner Template Class In A Template Class, Using an Enum class " pinskia at gcc dot gnu.org
2014-04-18 0:10 ` redi at gcc dot gnu.org
2014-06-06 9:30 ` paolo.carlini at oracle dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).