public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/57401] New: 'Conflicting declaration' involving using declaration and dependent name
@ 2013-05-24 17:56 lucdanton at free dot fr
  2013-06-21  9:04 ` [Bug c++/57401] " paolo.carlini at oracle dot com
  0 siblings, 1 reply; 2+ messages in thread
From: lucdanton at free dot fr @ 2013-05-24 17:56 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57401
           Summary: 'Conflicting declaration' involving using declaration
                    and dependent name
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lucdanton at free dot fr

Using 4.9.0 20130509 (experimental) [trunk revision 198734] with flags
-std=c++11:

$ cat main.cpp 
struct base {
    using base_type = base;
    using type = int;
};

template<typename T>
struct derived: T {
    using typename derived::base_type::type;

    // Uses of once dependent type, explicitly introduced
    // into scope by using declaration above -- no complaints
    type foo(type);

    // No complaints as well
    static type t;
};

// Error: conflicting declaration
template<typename T>
typename derived<T>::type derived<T>::t = 0;

int main()
{}

//-------------------

$ g++-snapshot -std=c++11 main.cpp 
main.cpp:20:39: error: conflicting declaration 'typename derived<T>::type
derived<T>::t'
 typename derived<T>::type derived<T>::t = 0;
                                       ^
main.cpp:15:17: error: 'derived<T>::t' has a previous declaration as 'typename
derived<T>::base_type::type derived<T>::t'
     static type t;
                 ^
main.cpp:20:39: error: declaration of 'typename derived<T>::base_type::type
derived<T>::t' outside of class is not definition [-fpermissive]
 typename derived<T>::type derived<T>::t = 0;
                                       ^

I suspect the code is wrongly rejected, as demonstrated by the other uses of
type as if it weren't a dependent type anymore. (Admittedly writing a
definition of foo that matches the declaration can be troublesome, but I assume
this is the same issue in another form.) If it is any indication, Clang accepts
the code.


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug c++/57401] 'Conflicting declaration' involving using declaration and dependent name
  2013-05-24 17:56 [Bug c++/57401] New: 'Conflicting declaration' involving using declaration and dependent name lucdanton at free dot fr
@ 2013-06-21  9:04 ` paolo.carlini at oracle dot com
  0 siblings, 0 replies; 2+ messages in thread
From: paolo.carlini at oracle dot com @ 2013-06-21  9:04 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2013-06-21
                 CC|                            |dodji at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Paolo Carlini <paolo.carlini at oracle dot com> ---
CC-ing Dodji.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-21  9:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-24 17:56 [Bug c++/57401] New: 'Conflicting declaration' involving using declaration and dependent name lucdanton at free dot fr
2013-06-21  9:04 ` [Bug c++/57401] " 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).